:root {
  --bg: #0a0b0f;
  --bg-2: #101218;
  --panel: #151823;
  --panel-2: #1b1f2e;
  --panel-3: #232838;
  --border: #262b3d;
  --border-2: #313850;
  --text: #eef1f8;
  --muted: #8b93a7;
  --muted-2: #616a80;
  --orange: #ff7a1a;
  --orange-2: #ff9a4d;
  --orange-soft: rgba(255, 122, 26, 0.14);
  --blue: #2f7bff;
  --blue-2: #5b9bff;
  --blue-soft: rgba(47, 123, 255, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --yellow: #f5b700;
  --yellow-soft: rgba(245, 183, 0, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: 'Inter', system-ui, sans-serif;
}

html[dir="rtl"] { --font: 'Cairo', system-ui, sans-serif; }

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

body {
  font-family: var(--font);
  background: radial-gradient(1200px 800px at 80% -10%, rgba(47,123,255,0.08), transparent 60%),
              radial-gradient(1000px 700px at -10% 110%, rgba(255,122,26,0.07), transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 600; transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--blue); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-lg { padding: 14px 22px; font-size: 16px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--orange), var(--orange-2)); border: none; color: #1a0d02; }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(255,122,26,.35); }
.btn-blue { background: linear-gradient(135deg, var(--blue), var(--blue-2)); border: none; color: #fff; }
.btn-blue:hover { box-shadow: 0 8px 24px rgba(47,123,255,.35); }
.btn-green { background: linear-gradient(135deg, #16a34a, var(--green)); border: none; color: #fff; }
.btn-danger { background: var(--red-soft); border-color: rgba(239,68,68,.4); color: #ffb4b4; }
.btn-danger:hover { border-color: var(--red); }
.btn-ghost { background: transparent; }
.icon-btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 18px; }
.chip-btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 20px; cursor: pointer; font-weight: 600; font-size: 13px; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 20px; padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800;
  background: linear-gradient(135deg, var(--orange), var(--blue)); color: #fff;
  box-shadow: 0 10px 30px rgba(255,122,26,.35);
}
.login-brand h1 { font-size: 26px; font-weight: 800; }
.login-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
#login-form label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
#login-form input {
  width: 100%; padding: 13px 14px; background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: 10px; color: var(--text); font-size: 15px; font-family: var(--font);
}
#login-form input:focus { outline: none; border-color: var(--orange); }
#login-form button { margin-top: 22px; }
.login-error { background: var(--red-soft); color: #ffb4b4; padding: 10px; border-radius: 8px;
  font-size: 13px; margin-top: 14px; text-align: center; }
.login-lang { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.lang-toggle { background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-family: var(--font); font-weight: 600; }
.lang-toggle.active { border-color: var(--orange); color: var(--orange); }

/* ---------- App layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
}
html[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid var(--border); }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; background: linear-gradient(135deg, var(--orange), var(--blue)); color: #fff;
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 17px; }
.nav { flex: 1; padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px;
  color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14.5px; transition: .15s; user-select: none;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--orange-soft); color: var(--orange-2); }
.nav-ico { font-size: 18px; width: 22px; text-align: center; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }

.main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-width: 0; }
html[dir="rtl"] .main { margin-left: 0; margin-right: 250px; }
.topbar {
  height: 66px; background: rgba(16,18,24,.8); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
/* In RTL, reverse topbar order so menu sits at the right */
html[dir="rtl"] .topbar { flex-direction: row-reverse; }
.page-title { font-size: 20px; font-weight: 800; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--orange));
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; }
#menu-toggle { display: none; }
.sidebar .close-btn { display: none; }
.content { padding: 24px; flex: 1; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-ico {
  position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
html[dir="rtl"] .stat-card .stat-ico { right: auto; left: 16px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -0.5px; }
.stat-sub { font-size: 12px; color: var(--muted-2); margin-top: 4px; }
.tint-orange .stat-ico { background: var(--orange-soft); color: var(--orange-2); }
.tint-blue .stat-ico { background: var(--blue-soft); color: var(--blue-2); }
.tint-green .stat-ico { background: var(--green-soft); color: var(--green); }
.tint-red .stat-ico { background: var(--red-soft); color: #ff8a8a; }
.tint-yellow .stat-ico { background: var(--yellow-soft); color: var(--yellow); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 12px 14px; color: var(--muted); font-weight: 700; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border);
}
html[dir="rtl"] thead th { text-align: right; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-flex; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: #ff8a8a; }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-blue { background: var(--blue-soft); color: var(--blue-2); }
.badge-orange { background: var(--orange-soft); color: var(--orange-2); }
.badge-gray { background: var(--panel-3); color: var(--muted); }

/* ---------- Forms ---------- */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 11px 13px; background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: 10px; color: var(--text); font-size: 14.5px; font-family: var(--font);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); }
textarea { resize: vertical; min-height: 70px; }
select option { background: var(--panel); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-box { position: relative; flex: 1; max-width: 340px; }
.search-box input { padding-left: 38px; }
html[dir="rtl"] .search-box input { padding-left: 13px; padding-right: 38px; }
.search-box::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .6; }
html[dir="rtl"] .search-box::before { left: auto; right: 12px; }

.section-title { font-size: 18px; font-weight: 800; margin: 4px 0 16px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
html[dir="rtl"] .toast-wrap { right: auto; left: 24px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border-2); border-left: 4px solid var(--blue);
  padding: 14px 18px; border-radius: 10px; box-shadow: var(--shadow); min-width: 250px;
  animation: slideIn .25s ease; font-weight: 600; font-size: 14px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--yellow); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 18px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-close { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 16px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ---------- POS ---------- */
.pos-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.pos-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pos-tab { padding: 9px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border);
  cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.pos-tab.active { background: var(--orange-soft); color: var(--orange-2); border-color: var(--orange); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.product-tile {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 12px;
  cursor: pointer; text-align: center; transition: .15s; position: relative;
}
.product-tile:hover { border-color: var(--orange); transform: translateY(-2px); }
.product-tile.gaming { border-color: rgba(47,123,255,.3); }
.product-tile.gaming:hover { border-color: var(--blue); }
.product-tile .pt-name { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.product-tile .pt-price { color: var(--orange-2); font-weight: 700; font-size: 13px; }
.product-tile .pt-stock { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.product-tile.out { opacity: .5; }
.pt-emoji { font-size: 26px; display: block; margin-bottom: 6px; }

.cart { position: sticky; top: 86px; }
.cart-items { max-height: 46vh; overflow-y: auto; margin: 14px 0; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-line .cl-name { flex: 1; min-width: 0; }
.cart-line .cl-name b { display: block; font-size: 14px; }
.cart-line .cl-name small { color: var(--muted-2); font-size: 12px; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); cursor: pointer; font-weight: 700; }
.qty-ctrl input { width: 46px; text-align: center; padding: 5px; }
.cl-price-input { width: 90px; padding: 6px 8px; text-align: right; }
.cl-total { font-weight: 700; min-width: 90px; text-align: right; }
html[dir="rtl"] .cl-total, html[dir="rtl"] .cl-price-input { text-align: left; }
.cl-remove { background: var(--red-soft); color: #ff8a8a; border: none; width: 26px; height: 26px; border-radius: 7px; cursor: pointer; }
.cart-total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.cart-total-row.grand { font-size: 22px; font-weight: 800; border-top: 1px solid var(--border-2); padding-top: 12px; margin-top: 6px; }
.grand .amount { color: var(--orange-2); }
.pay-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.pay-opt { padding: 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--panel-2); text-align: center; cursor: pointer; font-weight: 700; }
.pay-opt.active.paid { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.pay-opt.active.unpaid { border-color: var(--red); background: var(--red-soft); color: #ff8a8a; }
.empty-cart { text-align: center; color: var(--muted-2); padding: 30px 0; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red { color: #ff8a8a; }
.text-orange { color: var(--orange-2); }
.text-blue { color: var(--blue-2); }
.text-right { text-align: right; }
html[dir="rtl"] .text-right { text-align: left; }
.flex { display: flex; gap: 10px; align-items: center; }
.mt { margin-top: 16px; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.pill-tabs { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; }
.pill-tabs button { padding: 8px 16px; border: none; background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; font-weight: 700; font-family: var(--font); }
.pill-tabs button.active { background: var(--orange); color: #1a0d02; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted-2); }
.empty-state .es-ico { font-size: 46px; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.list-actions { display: flex; gap: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
}

@media (max-width: 1400px) {
  /* Sidebar becomes off-canvas earlier (tablet + split-screen) */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 240px;
    z-index: 999;
    left: 0;
    pointer-events: none;
    box-shadow: 0 12px 40px rgba(2,6,18,.6);
  }
  html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }
  .sidebar.open {
    transform: translateX(0) !important;
    pointer-events: auto;
  }

  .app::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 100;
  }
  .app.sidebar-open::before {
    opacity: 1;
    pointer-events: auto;
  }

  .main { margin-left: 0 !important; margin-right: 0 !important; }
  #menu-toggle { display: flex; }
  .sidebar .close-btn { display: inline-flex; }
  body.sidebar-open { overflow: hidden; }

  /* Arabic: pin burger to true right corner on responsive */
  html[dir="rtl"] .topbar {
    flex-direction: row-reverse;
    position: sticky;
  }
  html[dir="rtl"] #menu-toggle {
    position: absolute;
    right: 10px;
    left: auto;
    z-index: 1200;
  }
  html[dir="rtl"] .page-title {
    padding-right: 50px;
  }

  .sidebar .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
  }
  html[dir="rtl"] .sidebar .close-btn {
    right: auto;
    left: 10px;
  }

  .pos-layout { grid-template-columns: 1fr; }
  .cart { position: static; margin-top: 16px; }
  .two-col { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .card { padding: 16px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .product-tile { padding: 10px 8px; }
  .pt-emoji { font-size: 22px; }
  .product-tile .pt-name { font-size: 12px; }
  .product-tile .pt-price { font-size: 12px; }
  .modal { max-width: 90vw; }
}

@media (max-width: 768px) {
  /* rules above in 1024 block handle off-canvas behavior */
  
  .topbar { padding: 0 14px; gap: 10px; height: 60px; }
  .page-title { font-size: 16px; }
  .topbar-right { gap: 8px; }
  
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 12px; }
  .card { padding: 12px; border-radius: 10px; }
  
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
  .product-tile { padding: 8px 6px; }
  .pt-emoji { font-size: 20px; margin-bottom: 4px; }
  .product-tile .pt-name { font-size: 11px; margin-bottom: 4px; }
  .product-tile .pt-price { font-size: 11px; }
  
  .cart-items { max-height: 50vh; }
  .cart-line { gap: 6px; padding: 8px 0; }
  .qty-ctrl { gap: 4px; }
  .qty-ctrl input { width: 40px; }
  .cl-price-input { width: 70px; font-size: 12px; }
  .cl-total { min-width: 70px; font-size: 12px; }
  
  table { font-size: 12px; }
  thead th { padding: 8px 10px; font-size: 11px; }
  tbody td { padding: 8px 10px; }
  
  .pos-tabs { gap: 6px; }
  .pos-tab { padding: 8px 12px; font-size: 12px; border-radius: 8px; }
  .modal-head { padding: 14px 16px; }
  .modal-head h3 { font-size: 16px; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px; gap: 8px; }
  
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .search-box { max-width: 100%; }
  
  .two-col { gap: 12px; }
  .grid { gap: 12px; }
  .stats-grid { grid-template-columns: 1fr; }
  
  .toast-wrap { bottom: 12px; right: 12px; }
  html[dir="rtl"] .toast-wrap { right: auto; left: 12px; }
  .toast { min-width: 220px; padding: 12px 14px; font-size: 13px; }
  
  .empty-state { padding: 30px 12px; }
  .empty-state .es-ico { font-size: 40px; }
}

@media (max-width: 480px) {
  .sidebar { width: 220px; }
  .topbar { padding: 0 10px; height: 56px; }
  .page-title { font-size: 14px; }
  .avatar { width: 32px; height: 32px; font-size: 13px; }
  .content { padding: 8px; }
  .card { padding: 10px; }
  
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); gap: 4px; }
  .product-tile { padding: 6px 4px; border-radius: 8px; }
  .pt-emoji { font-size: 18px; margin-bottom: 3px; }
  .product-tile .pt-name { font-size: 10px; margin-bottom: 2px; }
  .product-tile .pt-price { font-size: 10px; }
  .product-tile .pt-stock { font-size: 9px; }
  
  .cart-line { gap: 4px; padding: 6px 0; }
  .cart-line .cl-name { flex: 0.5; min-width: 60px; }
  .qty-ctrl { gap: 2px; }
  .qty-ctrl button { width: 24px; height: 24px; font-size: 12px; }
  .qty-ctrl input { width: 32px; padding: 3px; font-size: 11px; }
  .cl-price-input { width: 60px; padding: 4px; font-size: 11px; }
  .cl-total { min-width: 60px; font-size: 11px; }
  .cl-remove { width: 22px; height: 22px; font-size: 12px; }
  
  .cart-total-row { font-size: 12px; }
  .cart-total-row.grand { font-size: 18px; }
  
  .pos-tabs { gap: 4px; margin-bottom: 10px; }
  .pos-tab { padding: 6px 10px; font-size: 11px; border-radius: 6px; }
  
  table { font-size: 11px; }
  thead th { padding: 6px 8px; font-size: 10px; }
  tbody td { padding: 6px 8px; }
  
  .form-row { margin-bottom: 10px; gap: 4px; }
  label { font-size: 12px; }
  input, select, textarea { padding: 8px 10px; font-size: 13px; border-radius: 8px; }
  
  .btn { padding: 8px 12px; font-size: 12px; gap: 6px; }
  .btn-lg { padding: 10px 14px; font-size: 14px; }
  
  .modal { max-width: 95vw; max-height: 85vh; }
  .modal-head { padding: 12px 14px; }
  .modal-head h3 { font-size: 14px; }
  .modal-body { padding: 12px; }
  .modal-foot { padding: 10px 12px; gap: 6px; }
  
  .toolbar { gap: 6px; margin-bottom: 10px; flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .btn { width: 100%; }
  
  .toast-wrap { bottom: 8px; right: 8px; width: calc(100% - 16px); }
  html[dir="rtl"] .toast-wrap { right: auto; left: 8px; }
  .toast { min-width: auto; width: 100%; }
  
  .login-card { padding: 24px 20px; }
  .login-ico { font-size: 44px; }
  .login-title { font-size: 20px; }
  .login-sub { font-size: 13px; }
  
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }
}

/* ---------- Print (save invoice / report as PDF) ---------- */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .toast-wrap, .modal-head .modal-close, .modal-foot { display: none !important; }
  .app, .main, .content { display: block !important; margin: 0 !important; }
  .modal-overlay { position: static; background: #fff; backdrop-filter: none; padding: 0; }
  .modal { box-shadow: none; border: none; max-width: 100%; background: #fff; color: #000; }
  .modal .card, .modal table { background: #fff !important; color: #000 !important; }
  .cart-total-row .muted, .modal .muted { color: #333 !important; }
}

/* ---------- RTL (Arabic) Fixes ---------- */
html[dir="rtl"] .pos-tabs {
  flex-direction: row-reverse;
}

html[dir="rtl"] .toolbar {
  flex-direction: row-reverse;
}

html[dir="rtl"] .toolbar .spacer {
  order: -1;
}

html[dir="rtl"] .cart-line {
  flex-direction: row-reverse;
}

html[dir="rtl"] .cart-line .cl-name {
  text-align: right;
}

html[dir="rtl"] .cart-total-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .pay-toggle {
  grid-template-columns: 1fr 1fr;
}

html[dir="rtl"] .qty-ctrl {
  flex-direction: row-reverse;
}

html[dir="rtl"] .cl-price-input {
  text-align: right;
}

html[dir="rtl"] .cl-total {
  text-align: right;
}

html[dir="rtl"] .empty-state {
  text-align: center;
}

html[dir="rtl"] .card-title {
  flex-direction: row-reverse;
}

html[dir="rtl"] .stat-card {
  padding-right: 70px;
  padding-left: 20px;
}

html[dir="rtl"] .modal-head {
  flex-direction: row-reverse;
}

html[dir="rtl"] .modal-foot {
  flex-direction: row-reverse;
}

html[dir="rtl"] .topbar-right {
  flex-direction: row-reverse;
}

html[dir="rtl"] .form-row input[type="number"],
html[dir="rtl"] .form-row input[type="text"],
html[dir="rtl"] .form-row select,
html[dir="rtl"] .form-row textarea {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .pos-layout {
  direction: rtl;
}

html[dir="rtl"] .product-tile {
  text-align: right;
}

html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] * {
  /* Ensure all elements respect RTL direction */
}

html[dir="rtl"] .sidebar-brand {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nav-item {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .topbar {
  flex-direction: row-reverse;
}

html[dir="rtl"] .page-title {
  order: 1;
}

html[dir="rtl"] .list-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] table thead th,
html[dir="rtl"] table tbody td {
  text-align: right;
  direction: rtl;
}

