@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-main: #f1f5f9;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --bg-sidebar-active: #2563eb;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  transition: width 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.sidebar:hover {
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 35;
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-header h1 {
  font-size: 1.4rem;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header .subtitle {
  font-size: 0.75rem;
  color: var(--text-sidebar);
  opacity: 0.7;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-sidebar);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.sidebar-text {
  transition: opacity 0.2s ease, max-width 0.3s ease;
  overflow: hidden;
  white-space: nowrap;
}

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

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

.nav-category {
  padding: 8px 20px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-sidebar);
  opacity: 0.5;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 3px solid transparent;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  border-right-color: #fff;
}

.nav-item i {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 45;
  padding: 6px 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.mobile-bottom-nav .mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  padding: 4px 2px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.65rem;
  cursor: pointer;
  transition: color 0.2s;
}

.mobile-bottom-nav .mobile-nav-item i {
  font-size: 1.15rem;
}

.mobile-bottom-nav .mobile-nav-item.active {
  color: var(--primary);
}

.mobile-bottom-nav .mobile-nav-item:hover {
  color: var(--primary);
}

.main-content {
  flex: 1;
  margin-right: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-right 0.3s ease;
}

.top-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.top-bar .page-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.content-area {
  flex: 1;
  padding: 24px;
  width: 100%;
  min-width: 0;
}

.card {
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 20px;
}

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

table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: right;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

table tr:hover {
  background: #f8fafc;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: 'Cairo', sans-serif;
}

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

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

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: #f8fafc;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #dbeafe; color: #2563eb; }

.toast-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.search-box {
  position: relative;
}

.search-box input {
  padding-right: 36px;
}

.search-box i {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}

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

@media (max-width: 1200px) and (min-width: 769px) {
  .sidebar {
    width: 70px;
    min-width: 70px;
  }
  .sidebar:hover {
    width: 260px;
    min-width: 260px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  }
  .sidebar .sidebar-text {
    opacity: 0;
    max-width: 0;
  }
  .sidebar:hover .sidebar-text {
    opacity: 1;
    max-width: 200px;
  }
  .sidebar .nav-category {
    height: 0;
    padding: 0;
    overflow: hidden;
  }
  .sidebar:hover .nav-category {
    height: auto;
    padding: 8px 20px 4px;
  }
  .nav-item {
    justify-content: center;
    padding: 12px 20px;
  }
  .sidebar:hover .nav-item {
    justify-content: flex-start;
  }
  .nav-item i {
    width: auto;
  }
  .sidebar-header {
    justify-content: center;
    padding: 16px 8px;
  }
  .sidebar:hover .sidebar-header {
    justify-content: space-between;
    padding: 20px;
  }
  .main-content {
    margin-right: 70px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
    width: min(88vw, 320px);
    min-width: min(88vw, 320px);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar .sidebar-text {
    opacity: 1;
    max-width: 200px;
  }
  .sidebar .nav-category {
    height: auto;
    padding: 8px 20px 4px;
  }
  .sidebar .nav-item {
    justify-content: flex-start;
    padding: 10px 20px;
  }
  .sidebar-close-btn {
    display: flex;
  }
  .sidebar-header {
    justify-content: space-between;
    padding: 20px;
  }
  .main-content {
    margin-right: 0;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .content-area {
    padding: 12px;
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }
  .top-bar {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  #current-date {
    font-size: 0.72rem !important;
    width: 100%;
    text-align: left;
  }
  .sidebar-toggle-btn {
    display: inline-flex;
  }
  
  /* Responsive grids */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  
  .stat-card {
    padding: 14px;
  }
  
  .stat-card .stat-value {
    font-size: 1.3rem;
  }
  
  .stat-card .stat-label {
    font-size: 0.75rem;
  }
  
  /* Responsive cards */
  .card-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .card-body {
    padding: 16px;
  }
  
  /* Responsive tables - horizontal scroll */
  .card-body:has(> table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  table th, table td {
    padding: 8px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  
  /* Responsive modals */
  .modal {
    width: 95%;
    max-width: 95%;
    margin: 10px;
  }
  
  .modal-header, .modal-body, .modal-footer {
    padding: 14px 16px;
  }
  
  /* Form improvements */
  .form-group {
    margin-bottom: 12px;
  }
  
  .form-input {
    padding: 10px 12px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Buttons on mobile */
  .btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
  
  .btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  
  /* Inventory split panel */
  .inv-split {
    flex-direction: column;
    height: auto;
  }
  
  .inv-list-panel, .inv-details-panel {
    width: 100%;
  }
  
  .inv-list-panel {
    height: 50vh;
    min-height: 300px;
  }
  
  .inv-details-panel {
    height: auto;
    min-height: 400px;
  }
  
  /* Toolbar improvements */
  .inv-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }
  
  .inv-toolbar .inv-search {
    min-width: 100%;
    order: -1;
  }
  
  /* Toast position */
  .toast-container {
    top: 10px;
    left: 10px;
    right: 10px;
  }
  
  .toast {
    font-size: 0.8rem;
    padding: 10px 16px;
  }
}

@media (min-width: 769px) {
  .sidebar-toggle-btn {
    display: none;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 100%;
    min-width: 100%;
  }
  .content-area {
    padding: 10px;
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }
  .top-bar {
    padding: 8px 10px;
  }
  .top-bar .page-title {
    font-size: 0.95rem;
  }
  #current-date {
    display: none;
  }
  
  /* Stats grid single column on very small screens */
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  /* Make cards full width */
  .card {
    border-radius: 10px;
  }
  
  /* Stack buttons vertically */
  .card-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .card-header .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Reduce font sizes */
  .stat-card .stat-value {
    font-size: 1.2rem;
  }
  
  /* Mobile-friendly table cards */
  .inv-product-item {
    padding: 12px;
  }
  
  .inv-pi-name {
    font-size: 0.9rem;
  }
  
  /* Smaller modals */
  .modal {
    border-radius: 12px;
  }
  
  .modal-header h3 {
    font-size: 1rem;
  }
  
  /* Form inputs larger for touch */
  .form-input {
    min-height: 44px;
    font-size: 16px;
  }
  
  select.form-input {
    padding-left: 28px;
  }
  
  /* Horizontal scroll for all tables on mobile */
  .card-body:has(> table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Generic table wrapper for mobile */
  .table-wrapper-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 0 -10px;
  }
  
  /* Buttons in card-header stack on mobile */
  .card-header {
    gap: 8px;
  }
  
  .card-header h3 {
    font-size: 0.95rem;
  }
  
  /* Pagination controls wrap */
  div[class*="pagination"] {
    flex-wrap: wrap;
    gap: 4px;
  }
}

.mobile-bottom-nav .mobile-nav-item {
  min-height: 52px;
}

.mobile-bottom-nav .mobile-nav-item span {
  line-height: 1.1;
}

.inv-container { position: relative; height: calc(100vh - 130px); }
.inv-toolbar { background: var(--bg-card); border-radius: 12px; padding: 12px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-toolbar .inv-count { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.inv-toolbar .inv-search { flex: 1; min-width: 200px; }
.inv-toolbar .inv-search input { width: 100%; }
.inv-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; cursor: pointer; border: 1.5px solid var(--border); background: var(--bg-card); color: var(--text-secondary); transition: all 0.2s; }
.inv-chip.active { border-color: var(--primary); background: rgba(37,99,235,0.08); color: var(--primary); }
.inv-chip i { font-size: 0.75rem; }
.inv-split { display: flex; gap: 8px; height: 100%; }
.inv-list-panel { width: 35%; background: #f0f4f8; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; }
.inv-list-header { padding: 12px; display: flex; justify-content: space-between; align-items: center; }
.inv-list-header h3 { font-size: 0.95rem; font-weight: 600; }
.inv-list-scroll { flex: 1; overflow-y: auto; padding: 4px 8px; }
.inv-details-panel { width: 65%; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); display: flex; flex-direction: column; overflow: hidden; }
.inv-details-header { padding: 16px; border-bottom: 1px solid var(--border); }
.inv-details-header h3 { font-size: 0.95rem; font-weight: 600; }
.inv-details-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; }
.inv-product-item { background: var(--bg-card); border: 1px solid rgba(0,0,0,0.08); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; transition: all 0.15s; }
.inv-product-item:hover { border-color: var(--primary); }
.inv-product-item.selected { background: rgba(37,99,235,0.06); border-color: var(--primary); border-width: 1.5px; }
.inv-product-item .inv-pi-name { font-size: 0.88rem; font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.inv-product-item .inv-pi-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.inv-product-item .inv-pi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.inv-pi-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.inv-pi-badge.qty-low { background: rgba(220,38,38,0.1); color: #dc2626; }
.inv-pi-badge.qty-mid { background: rgba(217,119,6,0.1); color: #d97706; }
.inv-pi-badge.qty-ok { background: rgba(22,163,74,0.1); color: #16a34a; }
.inv-pi-badge.price { background: rgba(37,99,235,0.06); color: var(--text-secondary); }
.inv-pi-menu { position: relative; }
.inv-pi-menu-btn { background: none; border: none; cursor: pointer; padding: 2px; color: var(--text-secondary); font-size: 1rem; }
.inv-pi-dropdown { position: absolute; left: 0; top: 100%; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 20; min-width: 160px; overflow: hidden; }
.inv-pi-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 14px; background: none; border: none; cursor: pointer; font-size: 0.82rem; font-family: 'Cairo',sans-serif; color: var(--text-primary); }
.inv-pi-dropdown button:hover { background: #f1f5f9; }
.inv-detail-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.inv-detail-card .inv-dc-title { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 2px; }
.inv-detail-card .inv-dc-value { font-size: 1rem; font-weight: 700; }
.inv-detail-row { display: flex; justify-content: space-between; align-items: flex-start; }
.inv-detail-actions { display: flex; gap: 2px; }
.inv-detail-actions button { background: none; border: none; cursor: pointer; padding: 4px; font-size: 1rem; border-radius: 4px; }
.inv-detail-actions .edit-btn { color: var(--primary); }
.inv-detail-actions .edit-btn:hover { background: rgba(37,99,235,0.1); }
.inv-detail-actions .del-btn { color: var(--danger); }
.inv-detail-actions .del-btn:hover { background: rgba(220,38,38,0.1); }
.inv-low-stock-warn { background: rgba(220,38,38,0.1); border-radius: 6px; padding: 6px 10px; margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 500; color: var(--danger); }
.inv-profit-positive { color: #2e7d32; }
.inv-profit-negative { color: var(--danger); }
.inv-storage-row { display: flex; gap: 6px; margin-top: 8px; }
.inv-storage-box { flex: 1; text-align: center; border-radius: 8px; padding: 8px 4px; }
.inv-storage-box i { font-size: 1rem; margin-bottom: 2px; }
.inv-storage-box .inv-sb-label { font-size: 0.72rem; font-weight: 700; display: block; }
.inv-storage-box .inv-sb-value { font-size: 0.9rem; font-weight: 700; display: block; }
.inv-storage-box.store-main { background: rgba(25,118,210,0.12); color: #1976D2; }
.inv-storage-box.store-s1 { background: rgba(56,142,60,0.12); color: #388E3C; }
.inv-storage-box.store-s2 { background: rgba(230,74,25,0.12); color: #E64A19; }
.inv-storage-box.store-s3 { background: rgba(123,31,162,0.12); color: #7B1FA2; }
.inv-storage-box.store-s4 { background: rgba(133,9,47,0.12); color: #85092f; }
.inv-movement-card { background: rgba(37,99,235,0.06); border-radius: 8px; padding: 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; margin-top: 8px; border: 1px solid rgba(37,99,235,0.15); }
.inv-movement-card:hover { background: rgba(37,99,235,0.1); }
.inv-fab { position: fixed; bottom: 24px; left: 24px; width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 1.5rem; box-shadow: var(--shadow-lg); display: flex; align-items: center; justify-content: center; transition: background 0.2s; z-index: 10; }
.inv-fab:hover { background: var(--primary-dark); }
.inv-divider { border-top: 1px solid var(--border); margin: 8px 0; }
.inv-section-title { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; margin-top: 8px; }
.inv-loss-warn { background: rgba(220,38,38,0.1); border-radius: 6px; padding: 6px 10px; margin-top: 6px; text-align: center; font-size: 0.82rem; font-weight: 500; color: var(--danger); }
.inv-calc-btn { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; font-size: 0.9rem; }
.inv-calc-btn.active { color: var(--primary); background: rgba(37,99,235,0.1); }
.inv-calc-btn:not(.active) { color: var(--text-secondary); }
.inv-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inv-form-section { font-weight: 600; margin: 12px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.inv-movement-list { max-height: 500px; overflow-y: auto; }
.inv-movement-item { border: 2px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; background: var(--bg-card); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.inv-movement-item.sale { border-right: 6px solid #2563eb; background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); }
.inv-movement-item.return { border-right: 6px solid #dc2626; background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%); }
.inv-movement-item.transfer { border-right: 6px solid #ea580c; background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%); }
.inv-movement-item.order { border-right: 6px solid #16a34a; background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%); }
.inv-movement-item.edit { border-right: 6px solid #9333ea; background: linear-gradient(135deg, #faf5ff 0%, #e9d5ff 100%); }
.inv-movement-item.purchase { border-right: 6px solid #ea580c; background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%); }
.inv-movement-item.payment { border-right: 6px solid #0891b2; background: linear-gradient(135deg, #ecfeff 0%, #a5f3fc 100%); }
.inv-movement-item .inv-mi-type { font-size: 0.92rem; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.inv-movement-item .inv-mi-type i { font-size: 1rem; }
.inv-movement-item.sale .inv-mi-type { color: #1e40af; font-size: 1rem; }
.inv-movement-item.return .inv-mi-type { color: #991b1b; font-size: 1rem; }
.inv-movement-item.transfer .inv-mi-type { color: #9a3412; font-size: 1rem; }
.inv-movement-item.order .inv-mi-type { color: #166534; font-size: 1rem; }
.inv-movement-item.edit .inv-mi-type { color: #7e22ce; font-size: 1rem; }
.inv-movement-item.purchase .inv-mi-type { color: #c2410c; font-size: 1rem; }
.inv-movement-item.payment .inv-mi-type { color: #0e7490; font-size: 1rem; }
.inv-movement-item .inv-mi-detail { font-size: 0.88rem; color: var(--text-primary); margin-bottom: 3px; line-height: 1.6; }
.inv-movement-item .inv-mi-detail strong { color: var(--text-primary); }
.inv-movement-item .inv-mi-date { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }
.inv-mi-old { text-decoration: line-through; color: var(--text-secondary); opacity: 0.7; }
.inv-mi-arrow { font-size: 0.7rem; color: var(--text-secondary); margin: 0 4px; }
.inv-mi-new { font-weight: 700; }
.inv-movement-search { margin-bottom: 10px; }
.inv-movement-search input { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.88rem; font-family: 'Cairo', sans-serif; direction: rtl; }
.inv-movement-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.inv-movement-search { position: relative; }
.inv-movement-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.inv-pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px; border-top: 1px solid var(--border); }
.inv-pagination button { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 0.82rem; font-family: 'Cairo', sans-serif; cursor: pointer; color: var(--text-primary); transition: all 0.15s; }
.inv-pagination button:hover { background: rgba(37,99,235,0.08); border-color: var(--primary); }
.inv-pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.inv-pagination button:disabled { opacity: 0.4; cursor: default; }
.inv-pagination .inv-pg-info { font-size: 0.78rem; color: var(--text-secondary); margin: 0 8px; }
.inv-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-secondary); }
.inv-placeholder i { font-size: 3rem; opacity: 0.3; margin-bottom: 10px; }
.inv-placeholder p { font-size: 0.9rem; text-align: center; }
.form-input.is-error { border-color: var(--danger); }
.form-error { color: var(--danger); font-size: 0.75rem; margin-top: 2px; padding-right: 4px; }
@media (max-width: 768px) {
  .inv-split { flex-direction: column; }
  .inv-list-panel, .inv-details-panel { width: 100%; height: 50%; }
}
