:root {
    --bg-app: #f4f7f6; --bg-sidebar: #ffffff; --bg-card: #ffffff; --bg-input: #f8fafc;
    --text-main: #0f172a; --text-muted: #64748b; --accent: #2563eb; --accent-hover: #1d4ed8;
    --border: #e2e8f0; --danger: #ef4444; --success: #10b981; --warning: #f59e0b; --info: #0ea5e9;
    --radius: 10px; --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    --bg-app: #0b1120; --bg-sidebar: #1e293b; --bg-card: #1e293b; --bg-input: #0f172a;
    --text-main: #f8fafc; --text-muted: #94a3b8; --accent: #3b82f6; --accent-hover: #60a5fa;
    --border: #334155; --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4); --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Tajawal', sans-serif; background: var(--bg-app); color: var(--text-main); overflow: hidden; transition: 0.3s; }

.login-wrapper { position: fixed; inset: 0; background: var(--bg-app); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.login-box { background: var(--bg-card); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); width: 90%; max-width: 350px; text-align: center; border: 1px solid var(--border); }
.login-box h2 { font-size: 24px; font-weight: 900; margin-bottom: 5px; color: var(--text-main); }
.login-box h2 span { color: var(--accent); }
.login-box p { color: var(--text-muted); margin-bottom: 20px; font-size: 13px; }
.login-box input { width: 100%; padding: 12px; margin-bottom: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-main); font-family: inherit; font-size: 13px; outline: none; transition: 0.2s; }
.login-box input:focus { border-color: var(--accent); }
.login-box button { width: 100%; padding: 12px; border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.login-error { color: var(--danger); font-size: 12px; font-weight: bold; min-height: 20px; }

.dashboard-layout { display: flex; flex-direction: column; height: 100vh; }
.sidebar { background: var(--bg-sidebar); border-top: 1px solid var(--border); display: flex; z-index: 50; transition: 0.3s; }
.sidebar-header { padding: 15px 20px; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 18px; font-weight: 800; color: var(--text-main); }
.sidebar-header span { color: var(--accent); }
.sidebar-nav { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--text-muted); cursor: pointer; border-radius: 8px; font-weight: 600; font-size: 13px; transition: all 0.3s; position: relative; overflow: hidden; }
.nav-link:hover { color: var(--text-main); background: var(--bg-input); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, var(--accent) 0%, rgba(59,130,246,0.8) 100%); box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3); }
.nav-link svg { transition: transform 0.3s; }
.nav-link.active svg { transform: scale(1.1); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding-bottom: 60px; }

/* إصلاح الشريط العلوي والأزرار العلوية */
.top-header { padding: 10px 15px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-card); position: sticky; top: 0; z-index: 10; transition: 0.3s; }
.header-title { font-size: 16px; font-weight: 900; white-space: nowrap; }
.header-actions-right { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.header-actions-right::-webkit-scrollbar { display: none; }

.btn-header { display: flex; align-items: center; justify-content: center; min-width: 38px; width: 38px; height: 38px; border-radius: 50%; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-main); cursor: pointer; transition: 0.2s; flex-shrink: 0; padding: 0; }
.btn-header svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-header span { display: none; }
.btn-header:hover { background: var(--border); }
.btn-header.danger-btn { color: var(--danger); border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.05); }
.btn-header.success-btn { color: var(--success); border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.05); }
.btn-header.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.connection-status { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; border-radius: 50%; background: var(--bg-input); border: 1px solid var(--border); transition: 0.3s; flex-shrink: 0; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warning); transition: 0.3s; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
.status-text { display: none; }

.content-wrapper { padding: 15px; }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 15px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm); transition: 0.3s; }
.stat-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; align-self: flex-start; }
.stat-icon svg { width: 18px; height: 18px; }
.stat-info p { color: var(--text-muted); font-size: 10px; margin-bottom: 2px; font-weight: 600; }
.stat-info h3 { font-size: 16px; font-weight: 900; color: var(--text-main); }

.section-header { margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.search-input { width: 100%; padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); font-family: inherit; font-size: 12px; outline: none; transition: 0.2s; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.header-actions { display: flex; gap: 8px; }

.table-container { width: 100%; }
.data-table { width: 100%; border-collapse: collapse; text-align: right; }
.badge { padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 800; display: inline-block; }
.badge.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge.neutral { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); }

.btn-primary, .btn-secondary, .btn-icon { font-family: inherit; font-weight: 700; border-radius: 8px; cursor: pointer; transition: 0.2s; border: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; padding: 10px 16px; flex: 1; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-main); padding: 10px 16px; }
.btn-secondary:hover { background: var(--border); }
.btn-icon { background: var(--bg-input); color: var(--text-muted); padding: 6px; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; }
.btn-icon:hover { color: var(--text-main); border-color: var(--text-muted); }
.btn-icon.edit { color: var(--accent); }
.btn-icon.delete, .danger-icon { color: var(--danger); background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.2); }
.btn-icon.success-icon, .success-icon { color: var(--success); background: rgba(16, 185, 129, 0.05); border-color: rgba(16, 185, 129, 0.2); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); display: none; align-items: flex-end; justify-content: center; z-index: 100; opacity: 0; transition: 0.3s; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content { background: var(--bg-card); width: 100%; border-radius: 16px 16px 0 0; border: 1px solid var(--border); box-shadow: 0 -10px 40px rgba(0,0,0,0.5); transform: translateY(100%); transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; }
.modal-overlay.active .modal-content { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 10px; margin: 10px auto 4px; }
.modal-header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--bg-card); z-index: 2; }
.modal-header h3 { font-size: 15px; font-weight: 800; color: var(--text-main); }
.close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }

.form-grid { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.form-group label { font-size: 11px; color: var(--text-muted); font-weight: 800; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); font-family: inherit; font-size: 12px; transition: 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.form-group input:disabled { opacity: 0.6; cursor: not-allowed; }

.status-toggle { display: flex; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.status-toggle button { flex: 1; padding: 8px; border: none; background: transparent; color: var(--text-muted); font-family: inherit; font-size: 11px; font-weight: 800; cursor: pointer; transition: 0.2s; }
.status-toggle button.active { background: var(--accent); color: #fff; }

.image-upload-area { border: 2px dashed var(--border); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); transition: 0.2s; background: var(--bg-input); text-align: center; padding: 8px; }
.image-upload-area:hover { border-color: var(--accent); color: var(--accent); }

.toast-container { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 6px; width: 90%; max-width: 320px; pointer-events: none; }
.toast { background: var(--accent); color: #fff; padding: 12px 14px; border-radius: 8px; font-size: 12px; font-weight: 800; box-shadow: var(--shadow); animation: slideDown 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); display: flex; justify-content: center; text-align: center; }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.pos-layout { max-width: 1000px !important; height: 90vh; }
.pos-body { display: grid; grid-template-columns: 1fr 320px; height: calc(100% - 50px); gap: 12px; padding: 12px; background: var(--bg-app); }
.pos-products-section { display: flex; flex-direction: column; overflow: hidden; }
.pos-search-results { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; align-content: start; padding-right: 4px; }
.pos-product-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer; transition: 0.2s; text-align: center; box-shadow: var(--shadow-sm); }
.pos-product-card:active { transform: scale(0.96); border-color: var(--accent); }
.pos-product-card img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; margin-bottom: 6px; border: 1px solid var(--border); }
.pos-cart-section { background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border); display: flex; flex-direction: column; padding: 12px; box-shadow: var(--shadow-sm); }
.cart-items { flex: 1; overflow-y: auto; border-bottom: 1px dashed var(--border); margin-bottom: 12px; padding-right: 4px; display: flex; flex-direction: column; gap: 6px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-radius: 6px; background: var(--bg-input); border: 1px solid var(--border); }
.cart-qty-ctrl { display: flex; align-items: center; gap: 6px; background: var(--bg-card); border-radius: 14px; padding: 2px; border: 1px solid var(--border); }
.cart-qty-ctrl button { background: var(--bg-input); border: none; color: var(--text-main); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-weight: bold; transition: 0.2s; display:flex; align-items:center; justify-content:center; }
.cart-summary { background: var(--bg-input); padding: 12px; border-radius: 8px; border: 1px solid var(--border); }

.dropdown-results { position:absolute; top:100%; left:0; right:0; background:var(--bg-card); border:1px solid var(--border); border-radius:6px; max-height:120px; overflow-y:auto; z-index:10; display:none; box-shadow:var(--shadow); margin-top:4px; }
.dropdown-item { padding:8px; cursor:pointer; border-bottom:1px solid var(--border); font-size:11px; font-weight:bold; }
.dropdown-item:hover { background:var(--bg-input); color:var(--accent); }

.logs-timeline { display: flex; flex-direction: column; gap: 6px; }
.log-item { display: flex; align-items: flex-start; gap: 10px; background: var(--bg-card); padding: 10px; border-radius: 8px; border: 1px solid var(--border); border-right: 3px solid var(--border); }

.sales-tabs-container { display: flex; padding: 10px 10px 0; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.sales-tab { background: transparent; border: none; color: var(--text-muted); font-family: inherit; font-size: 13px; font-weight: 800; padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; transition: 0.2s; white-space: nowrap; }
.sales-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.return-input { width: 50px !important; padding: 4px !important; text-align: center; border: 1px solid var(--danger) !important; color: var(--danger) !important; background: rgba(239,68,68,0.05) !important; border-radius: 4px; font-weight: bold; font-size: 11px; }

/* المعرض ونافذة عرض الصور (Lightbox) */
.details-gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 15px; }
.details-gallery::-webkit-scrollbar { height: 4px; }
.details-gallery::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.details-gallery img { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); cursor: pointer; flex-shrink: 0; transition: 0.2s; }
.details-gallery img:active { transform: scale(0.95); }

#imageLightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 99999; display: none; align-items: center; justify-content: center; opacity: 0; transition: 0.3s; }
#imageLightbox.active { display: flex; opacity: 1; }
#lightboxImg { max-width: 90%; max-height: 85vh; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); object-fit: contain; }
.close-lightbox { position: absolute; top: 20px; right: 20px; background: rgba(255,255,255,0.2); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* بطاقات الصيانة فائقة الضغط والترتيب - Ultra Compact & Uniform */
#repairsTableBody tr { display: block; margin-bottom: 8px; border: none; background: transparent; box-shadow: none; padding: 0; }
#repairsTableBody td { display: block; width: 100%; padding: 0; border: none; }

.compact-repair-card {
    position: relative;
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--shadow-sm);
    min-height: 95px;
    width: 100%;
}
.crc-img {
    width: 70px;
    flex-shrink: 0;
    margin-left: 10px;
}
.crc-img img, .crc-img div {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 8px;
    background: var(--bg-input); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.crc-img svg { width: 28px; height: 28px; }

.crc-content {
    flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0;
}
.crc-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

/* توحيد كل النصوص والمربعات داخل البطاقة (Pills) */
.crc-pill {
    background: var(--bg-input); border: 1px solid var(--border);
    padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: bold;
    color: var(--text-main); display: inline-flex; align-items: center;
}
.crc-pill.name { background: transparent; border: none; padding: 0; font-size: 14px; font-weight: 900; }
.crc-pill.phone { cursor: pointer; color: var(--accent); }
.crc-pill.danger { color: var(--danger); background: rgba(239,68,68,0.05); border-color: rgba(239,68,68,0.2); }
.crc-pill.warning { color: var(--warning); background: rgba(245,158,11,0.05); border-color: rgba(245,158,11,0.2); }
.crc-pill.success { color: var(--success); background: rgba(16,185,129,0.05); border-color: rgba(16,185,129,0.2); }
.crc-pill.neutral { color: var(--text-muted); background: rgba(100,116,139,0.05); border-color: rgba(100,116,139,0.2); }

.crc-actions { display: flex; gap: 6px; flex-shrink: 0; flex-direction: column; justify-content: center; margin-right: 10px; }
.crc-actions button { padding: 6px 14px; font-size: 11px; border-radius: 8px; height: 32px; }

.repair-details-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 10px; border-bottom: 1px dashed var(--border); font-size: 13px; }
.repair-details-label { color: var(--text-muted); font-weight: 800; font-size: 12px; }
.repair-details-val { font-weight: bold; color: var(--text-main); display: flex; align-items: center; justify-content: flex-end; }
.repair-quick-status { display: flex; flex-wrap: wrap; gap: 8px; }
.repair-quick-status button { flex: 1; min-width: 30%; padding: 10px; font-size: 12px; }

#productsTableBody td:nth-child(1), #productsTable th:nth-child(1) { display: none !important; }

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    
    .sidebar { position: fixed; bottom: 0; left: 0; right: 0; flex-direction: row; justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); background: var(--bg-card); border-top: 1px solid var(--border); box-shadow: 0 -2px 10px rgba(0,0,0,0.05); }
    .sidebar-nav { flex-direction: row; padding: 0; width: 100%; justify-content: space-around; }
    .nav-link { flex-direction: column; gap: 4px; padding: 6px; font-size: 10px; background: transparent !important; border: none !important; }
    .nav-link.active { color: var(--accent); box-shadow: none; }
    .nav-link.active svg { transform: translateY(-2px); }
    
    #productsTable th, #clientsTable th, #invoicesTable th, #offersTable th, #invDetailsTable th, #repairsTable th { display: none; }
    
    #clientsTableBody tr, #productsTableBody tr, #offersTableBody tr, #invoicesTableBody tr { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 12px; box-shadow: var(--shadow-sm); display: block; }
    #clientsTableBody td, #productsTableBody td, #offersTableBody td, #invoicesTableBody td { border: none; padding: 4px 0; text-align: right; display: flex; justify-content: space-between; align-items: center; }
    #clientsTableBody td::before, #productsTableBody td::before, #offersTableBody td::before, #invoicesTableBody td::before { display: none; }
    
    .pos-body { grid-template-columns: 1fr; padding: 10px; }
    .pos-cart-section { flex: none; height: auto; }
    
    /* جعل البطاقة ذكية في الجوال: الصورة في أقصى اليمين مطلقة */
    .compact-repair-card { padding: 10px 85px 10px 10px; min-height: 90px; flex-direction: column; }
    .crc-img { position: absolute; right: 10px; top: 10px; bottom: 10px; width: 65px; margin-left: 0; }
    .crc-actions { flex-direction: row; width: 100%; margin-top: 6px; margin-right: 0; }
    .crc-actions button { flex: 1; }
}

@media (min-width: 768px) {
    .hide-desktop { display: none !important; }
    
    .btn-header span { display: inline-block; font-size: 13px; font-weight: bold; margin-right: 6px; }
    .btn-header { width: auto; height: 38px; border-radius: 10px; padding: 0 16px; justify-content: flex-start; }
    .connection-status { padding: 0 14px; border-radius: 10px; height: 38px; }
    .status-text { display: inline-block; }
    
    .dashboard-layout { flex-direction: row; }
    .sidebar { width: 240px; height: 100vh; position: sticky; top: 0; flex-direction: column; border-right: 1px solid var(--border); border-top: none; }
    .main-content { padding-bottom: 20px; }
    .section-header { flex-direction: row; }
    .search-input { width: 300px; }
    .modal-overlay { align-items: center; }
    .modal-content { border-radius: var(--radius); max-height: 85vh; transform: translateY(20px); }
    
    #productsTableBody tr, #clientsTableBody tr, #invoicesTableBody tr, #offersTableBody tr, #invModalItems tr { display: table-row; background: var(--bg-card); transition: 0.2s; }
    #productsTableBody td, #clientsTableBody td, #invoicesTableBody td, #offersTableBody td, #invModalItems td { border-bottom: 1px solid var(--border); padding: 12px 16px; vertical-align: middle; display: table-cell; text-align: right; font-size: 13px; }
    #productsTableBody td::before, #clientsTableBody td::before, #invoicesTableBody td::before, #offersTableBody td::before, #invModalItems td::before { display: none; }
}

.invoice-group-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.invoice-group-header { background: var(--bg-input); padding: 10px 14px; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 13px; }
.settlement-summary-box { background: var(--bg-surface); padding: 14px; border-radius: 10px; border: 2px dashed var(--accent); margin-bottom: 15px; display: flex; justify-content: space-around; text-align: center; box-shadow: var(--shadow-sm); }
.summary-item .s-label { font-size: 11px; color: var(--text-muted); font-weight:bold; }
.summary-item .s-value { font-weight: 900; font-size: 15px; margin-top:4px; }

.pattern-board { border: 2px solid var(--border); border-radius: 10px; cursor: crosshair; touch-action: none; background: #fff; display: block; margin: 0 auto; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }

#printArea { display: none; }
@media print {
    @page { margin: 0; size: auto; }
    body, html { background: #fff; margin: 0; padding: 0; }
    body * { visibility: hidden; }
    #printArea, #printArea * { visibility: visible; color: #000 !important; font-family: 'Courier New', Courier, monospace, sans-serif !important; letter-spacing: -0.5px; }
    #printArea { display: block !important; position: absolute; top: 0; left: 0; right: 0; margin: 0 auto; width: 100%; max-width: 80mm; padding: 5px 10px; direction: rtl; background: #fff; box-sizing: border-box; text-align: right; }
    .ticket-header { text-align: center; margin-bottom: 8px; }
    .ticket-header h2 { font-size: 20px; font-weight: 900; margin: 0 0 2px 0; letter-spacing: 1px; }
    .ticket-header p { font-size: 11px; font-weight: bold; margin: 0; }
    .ticket-divider { border-top: 1px dashed #000; margin: 6px 0; width: 100%; }
    .ticket-meta { font-size: 11px; font-weight: bold; line-height: 1.5; }
    .ticket-meta-row { display: flex; justify-content: space-between; gap: 4px; }
    .ticket-table { width: 100%; border-collapse: collapse; font-size: 11px; font-weight: bold; margin-bottom: 5px; }
    .ticket-table th { text-align: right; border-bottom: 1px dashed #000; padding-bottom: 4px; }
    .ticket-table td { padding: 4px 0; vertical-align: top; }
    .ticket-table .t-item { width: 50%; padding-left: 4px; } 
    .ticket-table .t-qty { width: 15%; text-align: center; } 
    .ticket-table .t-price { width: 35%; text-align: left; } 
    .ticket-totals { margin-top: 8px; font-size: 12px; font-weight: bold; }
    .ticket-totals-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
    .ticket-grand-total { font-size: 14px; font-weight: 900; border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 4px 0; margin: 4px 0; }
    .ticket-footer { text-align: center; font-size: 10px; font-weight: bold; margin-top: 12px; }
    .ticket-footer p { margin: 2px 0; }
}