/* ============================================================
   Accounting + POS System - Complete Stylesheet (RTL)
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12);
  --sidebar: 250px;
  --header: 60px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  direction: rtl;
  overflow-x: hidden;
  overflow-y: auto;
  height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea {
  font-family: inherit; font-size: 14px; outline: none;
  border: 1.5px solid var(--gray-200); border-radius: 6px;
  padding: 8px 12px; background: #fff; width: 100%;
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 60px; }
table { width: 100%; border-collapse: collapse; }

/* ---- LAYOUT ---- */
.app-layout { display: flex; height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar); background: var(--gray-900); color: #fff;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  transition: transform .3s;
}
.sidebar-logo {
  padding: 18px 20px; font-size: 18px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo span { color: var(--primary); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: var(--gray-300);
  transition: all .2s; font-size: 14px; border-right: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.08); color: #fff;
  border-right-color: var(--primary);
}
.sidebar-nav a .icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-nav a .badge {
  background: var(--danger); color: #fff; font-size: 11px;
  padding: 1px 7px; border-radius: 10px; margin-right: auto;
}

/* ---- MAIN ---- */
.main {
  flex: 1; margin-right: var(--sidebar); display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}
.header {
  height: var(--header); background: #fff; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; padding: 0 24px; gap: 15px;
  flex-shrink: 0;
}
.header h2 { font-size: 18px; font-weight: 600; }
.header-left { display: flex; align-items: center; gap: 15px; margin-right: auto; }
.toggle-sidebar { display: none; background: none; font-size: 22px; color: var(--gray-600); }

.content {
  flex: 1; overflow-y: auto; padding: 20px 24px;
}

/* ---- CARDS / STATS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); border-right: 4px solid var(--primary);
}
.stat-card .label { font-size: 12px; color: var(--gray-500); text-transform: uppercase; margin-bottom: 4px; }
.stat-card .value { font-size: 24px; font-weight: 700; }
.stat-card .sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.stat-card.green { border-right-color: var(--success); }
.stat-card.red { border-right-color: var(--danger); }
.stat-card.yellow { border-right-color: var(--warning); }

/* ---- SECTION ---- */
.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.section-header h3 { font-size: 18px; font-weight: 600; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 6px; font-size: 13px; font-weight: 500;
  transition: all .2s;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; color: var(--gray-600); border: 1.5px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-100); }
.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { background: var(--gray-100); }

/* ---- TABLE ---- */
.table-wrap {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto;
}
table.data-table th, table.data-table td {
  padding: 10px 14px; text-align: right; font-size: 13px;
  white-space: nowrap;
}
table.data-table th {
  background: var(--gray-50); color: var(--gray-600); font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
}
table.data-table td { border-bottom: 1px solid var(--gray-100); }
table.data-table tr:hover td { background: var(--gray-50); }
table.data-table .actions { display: flex; gap: 4px; }
table.data-table .actions button { padding: 4px 8px; font-size: 11px; }

/* ---- BADGE / STATUS ---- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); width: 100%;
  max-width: 600px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn .25s;
}
.modal-lg { max-width: 800px; }
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
}
.modal-header h4 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; font-size: 20px; color: var(--gray-400); padding: 4px; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--gray-200);
}

/* ---- FORM ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--gray-600); }

/* ---- POS LAYOUT ---- */
.pos-layout {
  display: grid; grid-template-columns: 1fr 380px; gap: 20px;
  height: calc(100vh - var(--header) - 40px);
}
.pos-products {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; overflow: hidden;
}
.pos-search { margin-bottom: 12px; }
.pos-search input { padding: 10px 14px; font-size: 15px; }
.pos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; overflow-y: auto; flex: 1;
  align-content: start;
}
.pos-item {
  background: var(--gray-50); border: 1.5px solid var(--gray-200);
  border-radius: 8px; padding: 10px 8px; text-align: center;
  cursor: pointer; transition: all .15s;
}
.pos-item:hover { border-color: var(--primary); background: var(--primary-light); }
.pos-item .p-name { font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.pos-item .p-price { font-size: 14px; font-weight: 700; color: var(--primary); }
.pos-item .p-stock { font-size: 11px; color: var(--gray-400); }
.pos-item.out-of-stock { opacity: .5; pointer-events: none; }

.pos-cart {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.pos-cart-header { padding: 14px 16px; border-bottom: 1px solid var(--gray-200); font-weight: 600; display: flex; justify-content: space-between; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 8px; }
.pos-cart-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.pos-cart-item .ci-name { flex: 1; }
.pos-cart-item .ci-qty { width: 50px; text-align: center; }
.pos-cart-item .ci-qty input { width: 50px; text-align: center; padding: 2px 4px; }
.pos-cart-item .ci-total { font-weight: 600; width: 60px; text-align: left; }
.pos-cart-item .ci-remove { background: none; color: var(--danger); font-size: 16px; }
.pos-cart-summary { padding: 14px 16px; border-top: 1px solid var(--gray-200); }
.pos-cart-summary .cs-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.pos-cart-summary .cs-total { font-size: 18px; font-weight: 700; color: var(--primary); border-top: 2px solid var(--gray-200); padding-top: 6px; margin-top: 4px; }
.pos-pay { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; margin-top: 10px; }

/* ---- TOAST ---- */
.toast-container {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
  padding: 12px 24px; border-radius: 8px; color: #fff; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: toastIn .3s;
  text-align: center; min-width: 250px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- CHARTS ---- */
.chart-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 20px; min-height: 220px; }
.chart-wrap canvas { max-height: 280px; width: 100% !important; height: auto !important; }

/* ---- QUICK STATS ROW ---- */
.quick-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-mini {
  background: #fff; border-radius: 6px; padding: 10px 16px; box-shadow: var(--shadow);
  flex: 1; min-width: 120px; text-align: center;
}
.stat-mini .sm-value { font-size: 18px; font-weight: 700; }
.stat-mini .sm-label { font-size: 11px; color: var(--gray-500); }

/* ---- TABS ---- */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; background: var(--gray-100); border-radius: 8px; padding: 3px; }
.tab { padding: 8px 18px; border-radius: 6px; font-size: 13px; background: transparent; color: var(--gray-500); }
.tab.active { background: #fff; color: var(--gray-800); font-weight: 600; box-shadow: var(--shadow); }

/* ---- MISC ---- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; margin-bottom: 8px; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.w-full { width: 100%; }

/* ---- REPORT ---- */
.print-section { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.report-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
.report-item .ri-label { color: var(--gray-500); }
.report-item .ri-value { font-weight: 600; }
.report-total { font-size: 20px; font-weight: 700; color: var(--primary); text-align: center; padding: 16px; background: var(--primary-light); border-radius: 8px; margin-top: 12px; }

/* ============================================================
   RESPONSIVE — Mobile First
   ============================================================ */

/* ---- Tablet & smaller (≤ 1024px) ---- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .content { padding: 16px; }
}

/* ---- Mobile (≤ 768px) ---- */
@media (max-width: 768px) {
  .sidebar { width: 220px; }
  .sidebar-nav a { padding: 14px 16px; font-size: 14px; gap: 10px; }
  .sidebar-logo { padding: 14px 16px; font-size: 16px; }
  .header { padding: 0 14px; gap: 10px; }
  .header h2 { font-size: 15px; }
  .header-left { gap: 10px; }
  .header-left .btn span:not(.icon) { display: none; }
  .content { padding: 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 20px; }
  .stat-card .label { font-size: 11px; }
  .quick-row { gap: 8px; }
  .stat-mini { padding: 8px 10px; min-width: 80px; }
  .stat-mini .sm-value { font-size: 15px; }
  .section-header { margin-bottom: 14px; }
  .section-header h3 { font-size: 15px; }
  .section-actions .btn { padding: 6px 12px; font-size: 12px; }
  .section-actions .btn span:not(.icon) { display: none; }
  .table-wrap { border-radius: 6px; }
  table.data-table th,
  table.data-table td { padding: 8px 10px; font-size: 12px; }
  table.data-table .actions { gap: 2px; }
  table.data-table .actions button { padding: 4px 6px; font-size: 10px; }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-products { padding: 10px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
  .pos-item { padding: 8px 6px; }
  .pos-item .p-name { font-size: 11px; }
  .pos-item .p-price { font-size: 13px; }
  .pos-cart { max-height: 350px; }
  .pos-cart-header { padding: 10px 12px; font-size: 13px; }
  .pos-cart-item { font-size: 12px; padding: 6px; gap: 6px; }
  .pos-cart-item .ci-qty input { width: 40px; font-size: 12px; }
  .pos-cart-item .ci-total { width: 50px; font-size: 12px; }
  .pos-cart-summary { padding: 10px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .report-total { font-size: 17px; padding: 12px; }
  .chart-wrap { padding: 12px; min-height: 180px; }
  .chart-wrap canvas { max-height: 180px; }
  .modal { max-width: 100%; margin: 10px; max-height: 85vh; }
  .modal-lg { max-width: 100%; }
  .modal-body { padding: 14px; }
  .modal-header { padding: 12px 14px; }
  .modal-header h4 { font-size: 14px; }
  .modal-footer { padding: 12px 14px; }
  .auth-box { padding: 24px; }
  .invoice { padding: 12px; }
  .invoice-thin { max-width: 100%; }
  .print-section { padding: 14px; }
  .flex-between { gap: 8px; }
  .section-actions .btn { white-space: nowrap; }
  /* Dashboard chart grid → single column */
  div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ---- Small phones (≤ 480px) ---- */
@media (max-width: 480px) {
  .sidebar { width: 100%; }
  .sidebar-nav a { padding: 16px 20px; font-size: 15px; }
  .header { padding: 0 10px; }
  .header h2 { font-size: 13px; }
  .header-left .btn { padding: 6px 8px; font-size: 11px; }
  .toggle-sidebar { font-size: 20px; padding: 8px; min-width: 44px; min-height: 44px; }
  .content { padding: 10px; }
  .stats-grid { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .value { font-size: 18px; }
  .quick-row { gap: 6px; }
  .stat-mini { min-width: 70px; padding: 6px 8px; }
  .stat-mini .sm-value { font-size: 14px; }
  .stat-mini .sm-label { font-size: 10px; }
  .section-header { flex-direction: column; align-items: stretch; gap: 8px; }
  .section-actions { justify-content: stretch; }
  .section-actions .btn { flex: 1; justify-content: center; padding: 10px 8px; font-size: 12px; min-height: 44px; }
  .section-actions .btn span:not(.icon) { display: inline; font-size: 11px; }
  table.data-table th,
  table.data-table td { padding: 6px 6px; font-size: 11px; white-space: nowrap; }
  table.data-table .actions { gap: 2px; }
  table.data-table .actions button { padding: 6px 8px; font-size: 12px; min-width: 36px; min-height: 36px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 5px; }
  .pos-item { padding: 6px; }
  .pos-item .p-name { font-size: 10px; }
  .pos-item .p-price { font-size: 12px; }
  .pos-search input { padding: 10px 12px; font-size: 14px; }
  .pos-cart { max-height: 300px; }
  .pos-cart-item { flex-wrap: wrap; gap: 4px; }
  .pos-cart-item .ci-qty { width: 100%; display: flex; justify-content: center; margin-top: 2px; }
  .pos-cart-item .ci-qty input { width: 60px; padding: 4px; }
  .pos-cart-item .ci-remove { padding: 4px 8px; }
  .chart-wrap { padding: 10px; min-height: 160px; }
  .chart-wrap canvas { max-height: 180px; }
  .modal { margin: 6px; max-height: 90vh; }
  .form-grid { gap: 10px; }
  input, select, textarea { font-size: 16px; padding: 10px 10px; }
  .btn { padding: 10px 14px; font-size: 14px; min-height: 44px; }
  .btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
  .auth-box { padding: 20px; }
  .report-grid { gap: 10px; }
  .report-item { font-size: 13px; padding: 6px 0; }
  .print-section { padding: 10px; }
  .invoice { padding: 8px; font-size: 10px; }
  .invoice table th,
  .invoice table td { font-size: 9px; padding: 2px; }
  .invoice .totals div { font-size: 10px; }
  .invoice-header h2 { font-size: 14px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; gap: 0; }
  .tab { padding: 8px 12px; font-size: 12px; white-space: nowrap; min-height: 44px; }
  .toast { min-width: auto; width: 90%; font-size: 13px; padding: 10px 16px; }
  .modal-close { padding: 8px 12px; min-width: 44px; min-height: 44px; font-size: 24px; }
}

/* ---- Sidebar toggle (applied at all breakpoints) ---- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .toggle-sidebar { display: block; }
  .main { margin-right: 0; }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-cart { max-height: 400px; }
  .form-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  /* Chart grid 1 column on tablet */
  div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

@media print {
  .sidebar, .header, .section-actions, .btn, .no-print { display: none !important; }
  .main { margin: 0; }
  .print-section { box-shadow: none; padding: 0; }
  body { background: #fff; }
  .invoice { box-shadow: none !important; margin: 0; padding: 10px; font-size: 12px; }
  .invoice .no-print { display: none !important; }
  @page { margin: 10mm; size: auto; }
}

/* ---- INVOICE STYLES ---- */
.invoice {
  background: #fff; padding: 20px; max-width: 300px; margin: 0 auto;
  font-family: 'Segoe UI', Tahoma, sans-serif; direction: rtl;
}
.invoice-thin { max-width: 80mm; padding: 10px 8px; font-size: 11px; }
.invoice-header { text-align: center; border-bottom: 2px dashed #333; padding-bottom: 8px; margin-bottom: 8px; }
.invoice-header h2 { font-size: 16px; margin-bottom: 4px; }
.invoice-header p { font-size: 11px; color: #555; margin: 2px 0; }
.invoice-meta { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px dashed #999; }
.invoice table { width: 100%; border-collapse: collapse; font-size: 11px; margin-bottom: 6px; }
.invoice table th { background: #f0f0f0; padding: 4px 3px; text-align: center; border: 1px solid #ddd; font-size: 10px; }
.invoice table td { padding: 3px; text-align: center; border: 1px solid #eee; }
.invoice .totals { border-top: 2px solid #333; padding-top: 4px; margin-top: 4px; }
.invoice .totals div { display: flex; justify-content: space-between; padding: 2px 0; font-size: 11px; }
.invoice .totals .grand-total { font-size: 14px; font-weight: 700; border-top: 1px solid #333; padding-top: 4px; margin-top: 2px; }
.invoice-footer { text-align: center; font-size: 10px; color: #888; margin-top: 10px; border-top: 1px dashed #ccc; padding-top: 6px; }

/* ---- AUTH (Login / Register) ---- */
.auth-overlay {
  position: fixed; inset: 0; background: var(--gray-50); z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-box {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 32px; width: 100%; max-width: 380px;
}
.auth-box input { padding: 10px 14px; font-size: 14px; }

/* ---- HEADER USER INFO ---- */
#header-user { font-size: 12px; color: var(--gray-500); }
#header-user strong { color: var(--gray-700); }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   LTR Overrides — applied when html[dir="ltr"]
   ============================================================ */
html[dir="ltr"] body { direction: ltr; }
html[dir="ltr"] .sidebar { right: auto; left: 0; }
html[dir="ltr"] .sidebar-nav a { border-right: none; border-left: 3px solid transparent; }
html[dir="ltr"] .sidebar-nav a:hover,
html[dir="ltr"] .sidebar-nav a.active { border-left-color: var(--primary); }
html[dir="ltr"] .sidebar-nav a .badge { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .main { margin-right: 0; margin-left: var(--sidebar); }
html[dir="ltr"] .header-left { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .stat-card { border-right: none; border-left: 4px solid var(--primary); }
html[dir="ltr"] .stat-card.green { border-left-color: var(--success); }
html[dir="ltr"] .stat-card.red { border-left-color: var(--danger); }
html[dir="ltr"] .stat-card.yellow { border-left-color: var(--warning); }
html[dir="ltr"] table.data-table th,
html[dir="ltr"] table.data-table td { text-align: left; }
html[dir="ltr"] .pos-cart-item .ci-total { text-align: right; }
html[dir="ltr"] .invoice { direction: ltr; }
@media (max-width: 900px) {
  html[dir="ltr"] .sidebar { transform: translateX(-100%); }
  html[dir="ltr"] .sidebar.open { transform: translateX(0); }
  html[dir="ltr"] .main { margin-left: 0; }
}

/* ============================================================
   POSTER / LANDING PAGE (shown when not logged in)
   ============================================================ */
.poster-container {
  display: none;
  position: fixed; inset: 0;
  overflow-y: auto;
  background: #0a0f1e;
  padding: 20px;
  z-index: 1000;
}
.poster-container.open { display: block; }

.poster {
  width: 900px;
  max-width: 100%;
  margin: 0 auto;
  background: linear-gradient(160deg, #0d1b3e 0%, #0a1628 50%, #061020 100%);
  border-radius: 24px;
  position: relative;
  border: 1px solid rgba(59,130,246,0.3);
}
.poster::before {
  content: ''; position: absolute; top: -200px; left: -200px;
  width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.poster::after {
  content: ''; position: absolute; bottom: -150px; right: -150px;
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.p-grid-lines {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}
.p-header {
  position: relative; padding: 48px 52px 36px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.p-logo {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 36px; box-shadow: 0 8px 32px rgba(37,99,235,0.4); flex-shrink: 0;
}
.p-header-text h1 { font-size: 32px; font-weight: 900; color: #fff; line-height: 1.2; }
.p-header-text p { font-size: 15px; color: rgba(255,255,255,0.55); margin-top: 4px; }
.p-badge {
  margin-right: auto;
  background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.4);
  color: #34d399; font-size: 13px; font-weight: 700;
  padding: 6px 16px; border-radius: 100px; white-space: nowrap;
}
.p-hero { position: relative; padding: 40px 52px 32px; }
.p-hero h2 { font-size: 46px; font-weight: 900; color: #fff; line-height: 1.25; max-width: 680px; }
.p-hero h2 .blue { color: #60a5fa; }
.p-hero h2 .green { color: #34d399; }
.p-hero p { font-size: 17px; color: rgba(255,255,255,0.6); margin-top: 16px; line-height: 1.7; max-width: 600px; }
.p-hero-btns { display: flex; gap: 16px; margin-top: 32px; flex-wrap: wrap; }
.p-cta {
  display: inline-block; font-family: inherit; font-size: 16px; font-weight: 700;
  padding: 14px 36px; border-radius: 12px; text-decoration: none; border: none;
  cursor: pointer; transition: transform .25s, box-shadow .25s;
}
.p-cta:hover { transform: translateY(-2px); }
.p-cta-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
  box-shadow: 0 6px 24px rgba(37,99,235,0.45);
}
.p-cta-primary:hover { box-shadow: 0 10px 36px rgba(37,99,235,0.55); }
.p-cta-secondary {
  background: rgba(255,255,255,0.08); color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.2);
}
.p-cta-secondary:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.35); }
.p-section-label {
  padding: 0 52px 16px; font-size: 13px; font-weight: 700;
  color: #60a5fa; text-transform: uppercase; letter-spacing: 2px;
}
.p-stats {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 1px;
  background: rgba(255,255,255,0.06); margin: 0 52px 40px;
  border-radius: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,0.07);
}
.p-stat { background: rgba(255,255,255,0.03); padding: 24px 20px; text-align: center; }
.p-stat .num { font-size: 28px; font-weight: 900; color: #fff; }
.p-stat .num span { color: #60a5fa; }
.p-stat:last-child .num { color: #34d399; }
.p-stat .lbl { font-size: 13px; color: rgba(255,255,255,0.45); margin-top: 4px; }
.p-features {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 16px;
  padding: 0 52px 40px;
}
.p-feat {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 22px 20px;
  transition: border-color .3s, transform .3s, background .3s;
}
.p-feat:hover { border-color: rgba(96,165,250,0.35); background: rgba(255,255,255,0.07); transform: translateY(-3px); }
.p-feat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px;
}
.p-feat h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.p-feat p { font-size: 13px; color: rgba(255,255,255,0.5); line-height: 1.6; }
.p-icon-blue { background: rgba(37,99,235,0.2); }
.p-icon-green { background: rgba(16,185,129,0.2); }
.p-icon-amber { background: rgba(245,158,11,0.2); }
.p-icon-purple { background: rgba(139,92,246,0.2); }
.p-icon-rose { background: rgba(244,63,94,0.2); }
.p-icon-teal { background: rgba(20,184,166,0.2); }
.p-footer {
  padding: 28px 52px; border-top: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.p-footer-tagline { font-size: 13px; color: rgba(255,255,255,0.35); }

@media (max-width: 820px) {
  .poster { border-radius: 16px; }
  .p-header { padding: 28px 24px 24px; gap: 14px; }
  .p-header-text h1 { font-size: 26px; }
  .p-header-text p { font-size: 13px; }
  .p-badge { font-size: 12px; padding: 5px 12px; }
  .p-hero { padding: 28px 24px 24px; }
  .p-hero h2 { font-size: 30px; max-width: 100%; }
  .p-hero p { font-size: 15px; max-width: 100%; }
  .p-stats { grid-template-columns: repeat(2,1fr); margin: 0 24px 28px; }
  .p-features { grid-template-columns: repeat(2,1fr); padding: 0 24px 28px; gap: 12px; }
  .p-section-label { padding: 0 24px 12px; }
  .p-footer { padding: 20px 24px; text-align: center; }
  .p-logo { width: 56px; height: 56px; font-size: 28px; }
  .p-feat { padding: 18px 16px; }
}
@media (max-width: 480px) {
  .poster-container { padding: 12px; }
  .p-header-text h1 { font-size: 22px; }
  .p-hero h2 { font-size: 24px; }
  .p-hero p { font-size: 14px; }
  .p-stats { grid-template-columns: repeat(2,1fr); margin: 0 16px 24px; }
  .p-features { grid-template-columns: 1fr; padding: 0 16px 24px; }
  .p-section-label { padding: 0 16px 10px; font-size: 12px; }
  .p-footer { padding: 16px 20px; }
  .p-stat .num { font-size: 24px; }
  .p-hero-btns { flex-direction: column; gap: 12px; }
  .p-cta { width: 100%; text-align: center; font-size: 14px; padding: 12px 28px; }
  .p-header { padding: 20px 16px 18px; }
  .p-hero { padding: 20px 16px 18px; }
}
