/* Inventory Dashboard Styles */

/* Main Inventory Layout */
.inventory-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-lg);
}

.inventory-search {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  max-width: 500px;
}

.search-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid hsl(var(--input-border));
  border-radius: var(--radius);
  background: hsl(var(--input));
  color: hsl(var(--foreground));
  font-size: var(--font-size-sm);
}

.search-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

.inventory-actions {
  display: flex;
  gap: 0.5rem;
}

/* Widget Grid */
.inventory-widget-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.widget-small {
  grid-column: span 3;
}

.widget-medium {
  grid-column: span 6;
}

.widget-large {
  grid-column: span 12;
}

/* Stock Overview Widget */
.stock-overview-widget {
  --inv-card: 1;
}

.stock-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stock-stat {
  text-align: center;
  padding: 1rem;
  background: hsl(var(--surface-secondary));
  border-radius: var(--radius);
}

.stock-stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.stock-stat-label {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
}

/* Low Stock Alerts Widget */
.low-stock-widget {
  --inv-card: 1;
}

.low-stock-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
}

.low-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: hsl(var(--warning-light));
  border: 1px solid hsl(var(--warning) / 0.2);
  border-radius: var(--radius);
}

.low-stock-info {
  flex: 1;
}

.low-stock-product {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.low-stock-details {
  font-size: var(--font-size-xs);
  color: hsl(var(--foreground-secondary));
}

.low-stock-quantity {
  text-align: right;
  margin-right: 1rem;
}

.current-qty {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--warning));
}

.reorder-point {
  font-size: var(--font-size-xs);
  color: hsl(var(--foreground-muted));
}

.reorder-btn {
  padding: 0.25rem 0.75rem;
  border: 1px solid hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reorder-btn:hover {
  background: hsl(var(--primary-hover));
}

/* Recent Movements Widget */
.movements-widget {
  --inv-card: 1;
}

/* Unified Inventory Card styling similar to finance cards */
.stock-overview-widget,
.low-stock-widget,
.movements-widget,
.warehouse-card,
.quick-action-card,
.purchase-sales-cards {
  position: relative;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: .9rem;
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: 0 2px 4px -2px rgba(0, 0, 0, .08), 0 6px 20px -8px rgba(0, 0, 0, .18);
  overflow: hidden;
  transition: background .4s ease, box-shadow .55s ease, transform .65s cubic-bezier(.6, .3, .2, 1), border-color .5s ease;
  will-change: transform, box-shadow;
}

/* Inventory page scoped overrides to perfectly match finance widget look */
#inventory-content .inventory-page .stock-overview-widget,
#inventory-content .inventory-page .low-stock-widget,
#inventory-content .inventory-page .movements-widget,
#inventory-content .inventory-page .warehouse-card,
#inventory-content .inventory-page .quick-action-card,
#inventory-content .inventory-page .purchase-sales-cards {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 4px -2px rgba(0, 0, 0, .08), 0 4px 14px -4px rgba(0, 0, 0, .12);
  transition: background .4s ease, box-shadow .55s ease, transform .65s cubic-bezier(.6, .3, .2, 1), border-color .5s ease;
}

#inventory-content .inventory-page .stock-overview-widget::before,
#inventory-content .inventory-page .low-stock-widget::before,
#inventory-content .inventory-page .movements-widget::before,
#inventory-content .inventory-page .warehouse-card::before,
#inventory-content .inventory-page .quick-action-card::before,
#inventory-content .inventory-page .purchase-sales-cards::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: .65;
}

#inventory-content .inventory-page .stock-overview-widget:hover,
#inventory-content .inventory-page .low-stock-widget:hover,
#inventory-content .inventory-page .movements-widget:hover,
#inventory-content .inventory-page .warehouse-card:hover,
#inventory-content .inventory-page .quick-action-card:hover,
#inventory-content .inventory-page .purchase-sales-cards:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .35), 0 4px 12px -4px rgba(0, 0, 0, .25);
  border-color: var(--border-hover, var(--primary));
}

/* Widget header spacing parity */
#inventory-content .inventory-page .widget-header {
  padding: 1.1rem 1.25rem 0.85rem;
  gap: .85rem;
  border-bottom: 1px solid var(--border);
  margin: 0 0 .85rem;
}

#inventory-content .inventory-page .widget-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 .15rem;
}

#inventory-content .inventory-page .widget-subtitle {
  font-size: .65rem;
  letter-spacing: .05em;
}

/* Button styling parity (reuse finance sizing) */
#inventory-content .inventory-page .btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem 1.15rem;
  font-size: .78rem;
  font-weight: 600;
  border-radius: calc(var(--radius) * 1.6);
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--secondary);
  color: var(--foreground-secondary);
  transition: all var(--transition-fast, .35s ease);
  line-height: 1.15;
}

#inventory-content .inventory-page .btn-sm {
  padding: .5rem .8rem;
  font-size: .7rem;
  border-radius: calc(var(--radius) * 1.3);
}

#inventory-content .inventory-page .btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

#inventory-content .inventory-page .btn-primary:hover {
  background: var(--primary-hover);
}

#inventory-content .inventory-page .btn-outline {
  background: transparent;
  color: var(--foreground);
}

#inventory-content .inventory-page .btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#inventory-content .inventory-page .btn-ghost {
  background: transparent;
  color: var(--foreground-muted);
}

#inventory-content .inventory-page .btn-ghost:hover {
  background: var(--surface-secondary);
  color: var(--foreground);
}

/* Remove old button style influence inside inventory page to avoid conflicts */
#inventory-content .inventory-page .inventory-actions .btn,
#inventory-content .inventory-page .widget-actions .btn {
  box-shadow: none;
}

/* Accent bar hover effect */
.stock-overview-widget::after,
.low-stock-widget::after,
.movements-widget::after,
.warehouse-card::after,
.quick-action-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--accent)));
  transform: translateY(-100%);
  transition: transform .5s cubic-bezier(.6, .2, .2, 1);
  opacity: .9;
}

.stock-overview-widget:hover::after,
.low-stock-widget:hover::after,
.movements-widget:hover::after,
.warehouse-card:hover::after,
.quick-action-card:hover::after {
  transform: translateY(0);
}

/* Soft radial highlight */
.stock-overview-widget::before,
.low-stock-widget::before,
.movements-widget::before,
.warehouse-card::before,
.quick-action-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 120% -10%, hsl(var(--primary) / 0.18), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .55s ease;
}

.stock-overview-widget:hover::before,
.low-stock-widget:hover::before,
.movements-widget:hover::before,
.warehouse-card:hover::before,
.quick-action-card:hover::before {
  opacity: 1;
}

/* Interactive lift */
.stock-overview-widget:hover,
.low-stock-widget:hover,
.movements-widget:hover,
.warehouse-card:hover,
.quick-action-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px -6px rgba(0, 0, 0, .25), 0 0 0 1px hsl(var(--border));
}

/* Entrance animation (opt-in via .inv-enter class) */
@keyframes invCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.inv-enter {
  animation: invCardIn .65s cubic-bezier(.6, .3, .2, 1) both;
  animation-delay: calc(var(--seq)*45ms);
}

/* Headings inside cards */
.stock-overview-widget .widget-title,
.low-stock-widget .widget-title,
.movements-widget .widget-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .02em;
}

/* Adjust existing nested components for new padding */
.warehouse-card {
  padding-top: 1.25rem;
}

.movements-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
}

.movement-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: hsl(var(--surface-secondary));
  border-radius: var(--radius);
}

.movement-type-badge {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.movement-inbound {
  background: hsl(var(--success-light));
  color: hsl(var(--success));
}

.movement-outbound {
  background: hsl(var(--destructive-light));
  color: hsl(var(--destructive));
}

.movement-transfer {
  background: hsl(var(--accent) / 0.1);
  color: hsl(var(--accent));
}

.movement-adjustment {
  background: hsl(var(--warning-light));
  color: hsl(var(--warning));
}

.movement-info {
  flex: 1;
}

.movement-description {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.movement-details {
  font-size: var(--font-size-xs);
  color: hsl(var(--foreground-muted));
}

.movement-quantity {
  font-weight: 600;
  text-align: right;
}

/* Warehouse Cards Grid */
.warehouse-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.warehouse-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.warehouse-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.warehouse-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--accent)));
}

.warehouse-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.warehouse-info h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.25rem 0;
}

.warehouse-code {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
  font-family: 'Courier New', monospace;
}

.warehouse-location {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-muted));
}

.warehouse-icon {
  width: 2rem;
  height: 2rem;
  color: hsl(var(--primary));
}

.warehouse-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.warehouse-stat {
  text-align: center;
}

.warehouse-stat-value {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--foreground));
}

.warehouse-stat-label {
  font-size: var(--font-size-xs);
  color: hsl(var(--foreground-secondary));
}

.warehouse-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.warehouse-action-btn {
  padding: 0.5rem 1rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--surface-secondary));
  color: hsl(var(--foreground-secondary));
  border-radius: var(--radius);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.warehouse-action-btn:hover {
  background: hsl(var(--surface-tertiary));
  border-color: hsl(var(--border-hover));
}

.warehouse-action-btn.primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.warehouse-action-btn.primary:hover {
  background: hsl(var(--primary-hover));
}

/* ==== Modal parity appended (ensures placement after legacy modal styles if any) ==== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 2vw;
  background: hsl(var(--background) / 0.55);
  backdrop-filter: blur(4px);
}

/* Centered modal content (applies to ALL modals using .modal-overlay) */
.modal-overlay .modal-content {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  width: clamp(640px, 72vw, 1100px);
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 32px -8px rgba(0, 0, 0, .55), 0 4px 14px -6px rgba(0, 0, 0, .35);
  overflow: hidden;
  transform: scale(.94);
  opacity: 0;
  transition: transform .45s cubic-bezier(.55, .25, .2, 1), opacity .35s ease;
  overflow-x: hidden;
}

.modal-overlay.open .modal-content {
  transform: scale(1);
  opacity: 1;
}

.modal-overlay .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .85rem 1rem .75rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.modal-overlay .modal-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: .75;
}

.modal-overlay .modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.modal-overlay .modal-body {
  padding: 1rem 1.15rem 1.25rem;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Prevent horizontal scroll in wide content while expanding tables/forms */
.modal-overlay .modal-body table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

.modal-overlay .modal-body form,
.modal-overlay .modal-body .form-grid {
  max-width: 100%;
}

.modal-overlay .modal-body input,
.modal-overlay .modal-body select,
.modal-overlay .modal-body textarea {
  max-width: 100%;
  box-sizing: border-box;
}

.modal-overlay .modal-footer {
  padding: .75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  background: var(--surface-secondary);
}

.modal-overlay .modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: .4rem;
  border-radius: .55rem;
  color: var(--foreground-muted);
  transition: background .3s ease, color .3s ease;
}

.modal-overlay .modal-close-btn:hover {
  background: var(--surface-secondary);
  color: var(--foreground);
}

.modal-overlay .modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-overlay .modal-body::-webkit-scrollbar-track {
  background: var(--surface-secondary);
}

.modal-overlay .modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.modal-overlay .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay .modal-content {
    transition: none !important;
    transform: none !important;
  }

  .stock-overview-widget,
  .low-stock-widget,
  .movements-widget,
  .warehouse-card,
  .quick-action-card,
  .purchase-sales-cards {
    transition: none !important;
  }

  .inv-enter {
    animation: none !important;
  }
}

/* (Removed earlier temporary centered overrides to consolidate below) */

/* ==== Warehouse Side Panel (Distribution Center / Main Warehouse) Parity ==== */
.warehouse-panel-wrapper {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  justify-content: center;
  align-items: center;
  background: hsl(var(--background) / 0.45);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .45s ease;
}

.warehouse-panel-wrapper.open {
  opacity: 1;
}

.warehouse-panel-backdrop {
  position: absolute;
  inset: 0;
}

/* Centered warehouse modal panel */
.warehouse-side-panel {
  position: relative;
  width: min(1100px, 96vw);
  max-height: 90vh;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .5), 0 6px 18px -6px rgba(0, 0, 0, .4);
  transform: translateY(26px) scale(.97);
  opacity: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-width: none;
}

.warehouse-panel-wrapper.open .warehouse-side-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.warehouse-side-panel::-webkit-scrollbar {
  display: none;
}

.warehouse-side-panel::-webkit-scrollbar {
  width: 10px;
}

.warehouse-side-panel::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 6px;
}

.warehouse-side-panel::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--primary));
}

.warehouse-side-panel .panel-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.15rem .9rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  background: hsl(var(--card));
}

.warehouse-side-panel .panel-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: .75;
}

.warehouse-side-panel .panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.warehouse-side-panel .panel-subtitle {
  margin: 0;
  font-size: .65rem;
  letter-spacing: .05em;
  color: var(--foreground-muted);
}

.warehouse-side-panel .panel-close-btn {
  background: transparent;
  border: 1px solid var(--border);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .65rem;
  cursor: pointer;
  color: var(--foreground-muted);
  transition: background .35s ease, border-color .35s ease, color .35s ease;
}

.warehouse-side-panel .panel-close-btn:hover {
  background: var(--surface-secondary);
  color: var(--foreground);
}

.warehouse-side-panel .panel-tabs {
  display: flex;
  gap: .45rem;
  padding: .65rem 1rem;
  background: hsl(var(--surface-secondary));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.warehouse-side-panel .panel-tab {
  background: var(--secondary);
  border: 1px solid var(--border);
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .45rem .85rem;
  border-radius: .55rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--foreground-secondary);
  transition: background .3s ease, border-color .3s ease, color .3s ease;
}

.warehouse-side-panel .panel-tab:hover {
  border-color: var(--primary);
  color: var(--foreground);
}

.warehouse-side-panel .panel-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 0 0 1px hsl(var(--primary));
}

.warehouse-side-panel .panel-content {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.15rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: hsl(var(--card));
  scrollbar-width: none;
}

.warehouse-side-panel .panel-content::-webkit-scrollbar {
  display: none;
}

.warehouse-side-panel .inventory-tab-content {
  display: none;
  animation: invPanelFade .5s ease;
}

.warehouse-side-panel .inventory-tab-content.active {
  display: block;
}

@keyframes invPanelFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.warehouse-side-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: .65rem;
}

.warehouse-side-panel th,
.warehouse-side-panel td {
  padding: .45rem .55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.warehouse-side-panel tbody tr:hover {
  background: var(--surface-secondary);
}

.warehouse-side-panel .inventory-row-actions {
  display: flex;
  gap: .35rem;
}

.warehouse-side-panel .inventory-row-btn {
  background: var(--secondary);
  border: 1px solid var(--border);
  font-size: .55rem;
  padding: .3rem .55rem;
  border-radius: .45rem;
  cursor: pointer;
  color: var(--foreground-secondary);
  transition: background .3s ease, border-color .3s ease, color .3s ease;
}

.warehouse-side-panel .inventory-row-btn:hover {
  border-color: var(--primary);
  color: var(--foreground);
}

/* Purchase & Sales Quick Cards */
.purchase-sales-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.quick-action-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-action-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.quick-action-card.purchase {
  border-left: 4px solid hsl(var(--success));
}

.quick-action-card.sales {
  border-left: 4px solid hsl(var(--accent));
}

.quick-action-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: hsl(var(--primary));
}

.quick-action-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

/* === Hard Override: Force Warehouse Panel Center (end-of-file precedence) === */
html body .warehouse-panel-wrapper {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

html body .warehouse-panel-wrapper .warehouse-side-panel {
  margin: 0 !important;
  left: auto !important;
  right: auto !important;
  position: relative !important;
}

/* Force solid card background (remove any perceived transparency from theme blend) */
html body .warehouse-panel-wrapper .warehouse-side-panel,
html body .warehouse-panel-wrapper .warehouse-side-panel .panel-header,
html body .warehouse-panel-wrapper .warehouse-side-panel .panel-tabs,
html body .warehouse-panel-wrapper .warehouse-side-panel .panel-content {
  background: hsl(var(--card)) !important;
  backdrop-filter: none !important;
}

/* Opaque internal background layer (ensures no blur shows through) */
html body .warehouse-panel-wrapper .warehouse-side-panel {
  position: relative;
}

html body .warehouse-panel-wrapper .warehouse-side-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: hsl(var(--card));
  z-index: 0;
}

html body .warehouse-panel-wrapper .warehouse-side-panel>* {
  position: relative;
  z-index: 1;
}

@media (min-width: 1200px) {
  html body .warehouse-panel-wrapper .warehouse-side-panel {
    width: 1100px !important;
  }
}

/* Final hard override: ensure absolutely no transparency */
html body .warehouse-panel-wrapper .warehouse-side-panel,
html body .warehouse-panel-wrapper .warehouse-side-panel .panel-header,
html body .warehouse-panel-wrapper .warehouse-side-panel .panel-tabs,
html body .warehouse-panel-wrapper .warehouse-side-panel .panel-content {
  background: #0f1216 !important;
  /* opaque fallback */
  background-image: linear-gradient(180deg, #10151b 0%, #0c1014 100%) !important;
  backdrop-filter: none !important;
}

html body .warehouse-panel-wrapper .warehouse-side-panel::before {
  background: #0f1216 !important;
  opacity: 1 !important;
}

.quick-action-description {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
  margin-bottom: 1rem;
}

/* Side Panel */
.warehouse-side-panel {
  position: fixed;
  top: 0;
  right: -600px;
  width: 600px;
  height: 100vh;
  background: hsl(var(--card));
  border-left: 1px solid hsl(var(--card-border));
  box-shadow: var(--shadow-lg);
  transition: right var(--transition-slow);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.warehouse-side-panel.open {
  right: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--surface-secondary));
}

.panel-close-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  background: hsl(var(--surface-tertiary));
  color: hsl(var(--foreground-secondary));
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.panel-close-btn:hover {
  background: hsl(var(--surface-tertiary));
  color: hsl(var(--foreground));
}

.panel-title-section {
  flex: 1;
}

.panel-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.25rem 0;
}

.panel-subtitle {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--surface-secondary));
}

.panel-tab {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: hsl(var(--foreground-secondary));
  font-size: var(--font-size-sm);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

/* Side Panel Tab Content */
.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.inventory-tab-content {
  display: none;
}

.inventory-tab-content.active {
  display: block;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  background: hsl(var(--card));
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.inventory-table th,
.inventory-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.inventory-table th {
  background: hsl(var(--surface-secondary));
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground));
}

.inventory-table td {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
}

.inventory-row-actions {
  display: flex;
  gap: 0.25rem;
}

.inventory-row-btn {
  padding: 0.25rem 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--surface-secondary));
  color: hsl(var(--foreground-secondary));
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.inventory-row-btn:hover {
  background: hsl(var(--surface-tertiary));
  border-color: hsl(var(--border-hover));
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform var(--transition-fast);
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--surface-secondary));
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
}

.modal-close-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  background: hsl(var(--surface-tertiary));
  color: hsl(var(--foreground-secondary));
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: hsl(var(--surface-tertiary));
  color: hsl(var(--foreground));
}

.modal-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--surface-secondary));
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid hsl(var(--input-border));
  border-radius: var(--radius);
  background: hsl(var(--input));
  color: hsl(var(--foreground));
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

.form-input:disabled,
.form-input[readonly] {
  background: hsl(var(--surface-secondary));
  color: hsl(var(--foreground-muted));
  cursor: not-allowed;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: hsl(var(--foreground-muted));
  margin-top: 0.25rem;
}

.form-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: hsl(var(--primary));
}

/* Typeahead Styles */
.typeahead-container {
  position: relative;
}

.typeahead-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
}

.typeahead-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.typeahead-item {
  padding: 0.75rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.typeahead-item:hover {
  background: hsl(var(--surface-secondary));
}

.typeahead-item-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.typeahead-item-subtitle {
  font-size: var(--font-size-xs);
  color: hsl(var(--foreground-secondary));
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--font-size-xs);
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.btn-primary:hover {
  background: hsl(var(--primary-hover));
  border-color: hsl(var(--primary-hover));
}

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--secondary));
}

.btn-secondary:hover {
  background: hsl(var(--secondary-hover));
  border-color: hsl(var(--secondary-hover));
}

.btn-outline {
  background: transparent;
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.btn-outline:hover {
  background: hsl(var(--surface-secondary));
  border-color: hsl(var(--border-hover));
}

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground-secondary));
  border-color: transparent;
}

.btn-ghost:hover {
  background: hsl(var(--surface-secondary));
  color: hsl(var(--foreground));
}

.btn-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(var(--destructive));
}

.btn-destructive:hover {
  background: hsl(var(--destructive-hover));
  border-color: hsl(var(--destructive-hover));
}

.btn-icon {
  width: 1rem;
  height: 1rem;
}

/* Widget Styles */
.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1.5rem;
}

.widget-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.25rem 0;
}

.widget-subtitle {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
  margin: 0;
}

.widget-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* History and Details Styles */
.item-history-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.item-history-header h4 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.5rem 0;
}

.item-history-header p {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
  margin: 0.25rem 0;
}

.history-table,
.movements-table {
  width: 100%;
  border-collapse: collapse;
  background: hsl(var(--card));
  border-radius: var(--radius);
  overflow: hidden;
}

.history-table th,
.history-table td,
.movements-table th,
.movements-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.history-table th,
.movements-table th {
  background: hsl(var(--surface-secondary));
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground));
}

.history-table td,
.movements-table td {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
}

.movements-table tbody tr {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.movements-table tbody tr:hover {
  background: hsl(var(--surface-secondary));
}

.movements-filter {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.movements-filter .search-input,
.movements-filter .form-input {
  flex: 1;
}

.all-movements-list {
  max-height: 400px;
  overflow-y: auto;
}

/* Movement Details */
.movement-details {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-section h4 {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 1rem 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-item label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: hsl(var(--foreground-secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-item span {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground));
}

/* Import/Export Options */
.import-export-options {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.option-section h4 {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 1rem 0;
}

.import-options,
.export-options,
.sample-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stocktake-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.option-card {
  padding: 1.5rem;
  background: hsl(var(--surface-secondary));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.option-card:hover {
  background: hsl(var(--surface-tertiary));
  border-color: hsl(var(--border-hover));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.option-card h4 {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.5rem 0;
}

.option-card p {
  font-size: var(--font-size-sm);
  color: hsl(var(--foreground-secondary));
  margin: 0;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-fast);
  max-width: 400px;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-left: 4px solid hsl(var(--success));
}

.toast.error {
  border-left: 4px solid hsl(var(--destructive));
}

.toast.info {
  border-left: 4px solid hsl(var(--accent));
}

.toast.warning {
  border-left: 4px solid hsl(var(--warning));
}

.panel-tab:hover:not(.active) {
  color: hsl(var(--foreground));
  background: hsl(var(--surface-tertiary));
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Panel Tab Contents */
.inventory-tab-content {
  display: none;
}

.inventory-tab-content.active {
  display: block;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.inventory-table th,
.inventory-table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  font-size: var(--font-size-sm);
}

.inventory-table th {
  font-weight: 600;
  color: hsl(var(--foreground-secondary));
  background: hsl(var(--surface-secondary));
}

.inventory-table tr:hover {
  background: hsl(var(--surface-secondary));
}

.inventory-row-actions {
  display: flex;
  gap: 0.25rem;
}

.inventory-row-btn {
  padding: 0.25rem 0.5rem;
  border: none;
  background: hsl(var(--surface-tertiary));
  color: hsl(var(--foreground-secondary));
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.inventory-row-btn:hover {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: hsl(var(--backdrop));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--transition-fast);
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
}

.modal-close-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: hsl(var(--foreground-secondary));
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: hsl(var(--surface-secondary));
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid hsl(var(--input-border));
  border-radius: var(--radius);
  background: hsl(var(--input));
  color: hsl(var(--foreground));
  font-size: var(--font-size-sm);
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

.form-error {
  color: hsl(var(--destructive));
  font-size: var(--font-size-xs);
  margin-top: 0.25rem;
}

.form-help {
  color: hsl(var(--foreground-muted));
  font-size: var(--font-size-xs);
  margin-top: 0.25rem;
}

/* Typeahead */
.typeahead-container {
  position: relative;
}

.typeahead-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.typeahead-dropdown.open {
  display: block;
}

.typeahead-item {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid hsl(var(--border));
  transition: background-color var(--transition-fast);
}

.typeahead-item:last-child {
  border-bottom: none;
}

.typeahead-item:hover,
.typeahead-item.selected {
  background: hsl(var(--surface-secondary));
}

.typeahead-item-title {
  font-weight: 500;
  color: hsl(var(--foreground));
}

.typeahead-item-subtitle {
  font-size: var(--font-size-xs);
  color: hsl(var(--foreground-secondary));
}

/* Notification Toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  z-index: 3000;
  opacity: 0;
  transform: translateX(100%);
  transition: all var(--transition-fast);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  border-left: 4px solid hsl(var(--success));
}

.toast.error {
  border-left: 4px solid hsl(var(--destructive));
}

.toast.warning {
  border-left: 4px solid hsl(var(--warning));
}

/* Responsive Design */
@media (max-width: 1200px) {
  .inventory-widget-grid {
    grid-template-columns: repeat(8, 1fr);
  }

  .widget-small {
    grid-column: span 4;
  }

  .widget-medium {
    grid-column: span 8;
  }

  .warehouse-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .warehouse-side-panel {
    width: 500px;
    right: -500px;
  }
}

@media (max-width: 768px) {
  .inventory-widget-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .widget-small,
  .widget-medium,
  .widget-large {
    grid-column: span 1;
  }

  .inventory-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    text-align: left;
  }

  .inventory-search {
    max-width: none;
    width: 100%;
  }

  .inventory-search .search-input {
    width: 100%;
  }

  .warehouse-cards-grid {
    grid-template-columns: 1fr;
  }

  .warehouse-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .purchase-sales-cards {
    grid-template-columns: 1fr;
  }

  .warehouse-side-panel {
    width: 100%;
    right: -100%;
  }

  .modal-content {
    width: 95%;
    margin: 1rem;
  }

  /* Mobile-specific inventory optimizations */
  .stock-overview-widget,
  .low-stock-widget,
  .movements-widget,
  .warehouse-card,
  .quick-action-card {
    margin-bottom: 1rem;
    padding: 1rem;
  }

  .stock-stats {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .stock-stat {
    padding: 0.75rem;
    text-align: center;
  }

  .low-stock-list {
    max-height: 200px;
  }

  .low-stock-item {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 0.75rem;
  }

  .low-stock-info {
    margin-bottom: 0.5rem;
  }

  .low-stock-quantity {
    text-align: center;
    margin-right: 0;
  }

  .warehouse-header {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .warehouse-info {
    text-align: center;
  }

  .warehouse-stats {
    gap: 0.5rem;
  }

  .warehouse-stat {
    padding: 0.5rem;
  }

  .warehouse-actions {
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .warehouse-action-btn {
    flex: 1;
    min-width: auto;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .inventory-table {
    font-size: var(--font-size-xs);
  }

  .inventory-table th,
  .inventory-table td {
    padding: 0.5rem;
  }

  .warehouse-card {
    padding: 1rem;
  }

  .panel-content {
    padding: 1rem;
  }
}

.reorder-btn {
  padding: .7rem 1.1rem;
  font-size: .75rem;
  border-radius: calc(var(--radius) * 1.4);
}

.warehouse-action-btn {
  padding: .75rem 1.25rem;
  font-size: .8rem;
  border-radius: calc(var(--radius) * 1.55);
}

/* ============================================= */
/* CRITICAL MOBILE-FIRST RTL INVENTORY FIXES   */
/* Real Mobile Device Optimization             */
/* ============================================= */

/* PHASE 1: Mobile-First Base RTL Container */
@media screen and (max-width: 768px) {

  /* Force mobile viewport behavior */
  html.rtl {
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.rtl {
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
    overflow-x: hidden !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
  }

  /* CRITICAL: Mobile viewport meta enforcement */
  .rtl .dashboard-container {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    overflow-x: hidden !important;
    position: relative !important;
    direction: rtl !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* CRITICAL: Main content mobile RTL container */
  .rtl .main-content {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    margin: 0 !important;
    padding: 4rem 0.5rem 1rem 0.5rem !important;
    overflow-x: hidden !important;
    direction: rtl !important;
    text-align: right !important;
    position: relative !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* CRITICAL: Page container mobile RTL */
  .rtl .page {
    width: 100% !important;
    max-width: 100% !important;
    direction: rtl !important;
    text-align: right !important;
    overflow-x: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
  }

  /* INVENTORY PAGE SPECIFIC MOBILE RTL FIXES */
  .rtl #inventory-page {
    width: 100% !important;
    max-width: 100% !important;
    direction: rtl !important;
    text-align: right !important;
    overflow-x: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
  }

  .rtl #inventory-content {
    width: 100% !important;
    max-width: 100% !important;
    direction: rtl !important;
    text-align: right !important;
    overflow-x: hidden !important;
    padding: 0.5rem !important;
    box-sizing: border-box !important;
    position: relative !important;
  }

  /* Page header mobile RTL */
  .rtl .page-header {
    direction: rtl !important;
    text-align: right !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 1rem 0 !important;
    box-sizing: border-box !important;
  }

  .rtl .page-header h1 {
    direction: rtl !important;
    text-align: right !important;
    margin: 0 0 0.5rem 0 !important;
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }

  .rtl .page-header p {
    direction: rtl !important;
    text-align: right !important;
    margin: 0 !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
  }

  /* PHASE 2: Inventory Header Mobile RTL */
  .rtl .inventory-header {
    direction: rtl !important;
    text-align: right !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding: 1rem 0.5rem !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
  }

  /* PHASE 3: Search Input Mobile RTL - CRITICAL FIX */
  .rtl .inventory-search {
    direction: rtl !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }

  .rtl .inventory-search .search-input,
  .rtl .search-input {
    width: 100% !important;
    max-width: 100% !important;
    direction: rtl !important;
    text-align: right !important;
    padding: 0.75rem 2.75rem 0.75rem 0.75rem !important;
    font-size: 16px !important;
    /* Prevent iOS zoom */
    box-sizing: border-box !important;
    border: 1px solid hsl(var(--input-border)) !important;
    border-radius: var(--radius) !important;
    background: hsl(var(--input)) !important;
    color: hsl(var(--foreground)) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  .rtl .inventory-search .search-input::placeholder,
  .rtl .search-input::placeholder {
    direction: rtl !important;
    text-align: right !important;
    color: hsl(var(--foreground-muted)) !important;
  }

  /* Search icon positioning - CRITICAL */
  .rtl .inventory-search .search-icon,
  .rtl .search-wrapper .search-icon {
    position: absolute !important;
    left: 0.75rem !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 1rem !important;
    height: 1rem !important;
    color: hsl(var(--foreground-muted)) !important;
    pointer-events: none !important;
    z-index: 2 !important;
  }

  /* PHASE 4: Widget Grid Mobile RTL */
  .rtl .inventory-widget-grid {
    direction: rtl !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  /* Widget cards mobile RTL */
  .rtl .stock-overview-widget,
  .rtl .low-stock-widget,
  .rtl .movements-widget,
  .rtl .warehouse-card,
  .rtl .quick-action-card {
    direction: rtl !important;
    text-align: right !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 1rem 0 !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
  }

  /* Widget headers */
  .rtl .widget-header {
    direction: rtl !important;
    text-align: right !important;
    display: flex !important;
    flex-direction: row-reverse !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
  }

  .rtl .widget-title {
    direction: rtl !important;
    text-align: right !important;
    margin: 0 0 0.25rem 0 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
  }

  .rtl .widget-subtitle {
    direction: rtl !important;
    text-align: right !important;
    margin: 0 !important;
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
  }

  .rtl .widget-actions {
    direction: rtl !important;
    display: flex !important;
    flex-direction: row-reverse !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
  }

  /* PHASE 5: Stock Stats Mobile RTL */
  .rtl .stock-stats {
    direction: rtl !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .rtl .stock-stat {
    direction: rtl !important;
    text-align: center !important;
    padding: 0.75rem !important;
    background: hsl(var(--surface-secondary)) !important;
    border-radius: var(--radius) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .rtl .stock-stat-value {
    direction: ltr !important;
    unicode-bidi: embed !important;
    display: block !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    margin-bottom: 0.25rem !important;
    text-align: center !important;
  }

  .rtl .stock-stat-label {
    direction: rtl !important;
    text-align: center !important;
    font-size: 0.8rem !important;
    color: hsl(var(--foreground-secondary)) !important;
  }

  /* PHASE 6: Low Stock Items Mobile RTL */
  .rtl .low-stock-list {
    direction: rtl !important;
    width: 100% !important;
    max-height: 250px !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .rtl .low-stock-item {
    direction: rtl !important;
    text-align: right !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.75rem !important;
    background: hsl(var(--warning-light, var(--surface-secondary))) !important;
    border: 1px solid hsl(var(--warning, var(--border)) / 0.3) !important;
    border-radius: var(--radius) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .rtl .low-stock-info {
    direction: rtl !important;
    text-align: right !important;
    margin-bottom: 0.5rem !important;
    width: 100% !important;
  }

  .rtl .low-stock-product {
    direction: rtl !important;
    text-align: right !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.25rem !important;
    line-height: 1.3 !important;
  }

  .rtl .low-stock-details {
    direction: rtl !important;
    text-align: right !important;
    font-size: 0.8rem !important;
    color: hsl(var(--foreground-secondary)) !important;
    line-height: 1.4 !important;
  }

  .rtl .low-stock-quantity {
    direction: rtl !important;
    text-align: center !important;
    margin: 0.5rem 0 0 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 1rem !important;
  }

  .rtl .current-qty,
  .rtl .reorder-point {
    direction: ltr !important;
    unicode-bidi: embed !important;
    display: inline-block !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
  }

  .rtl .reorder-btn {
    direction: rtl !important;
    text-align: center !important;
    margin-top: 0.5rem !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.75rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* PHASE 7: Small Mobile Devices (480px and below) */
@media screen and (max-width: 480px) {
  .rtl #inventory-content {
    padding: 0.25rem !important;
  }

  .rtl .inventory-header {
    padding: 0.75rem 0.25rem !important;
  }

  .rtl .stock-overview-widget,
  .rtl .low-stock-widget,
  .rtl .movements-widget,
  .rtl .warehouse-card,
  .rtl .quick-action-card {
    padding: 0.75rem !important;
    margin-bottom: 0.75rem !important;
  }

  .rtl .search-input {
    font-size: 16px !important;
    /* Prevent iOS zoom */
    padding: 0.625rem 2.5rem 0.625rem 0.625rem !important;
  }

  .rtl .widget-title {
    font-size: 1rem !important;
  }

  .rtl .stock-stat {
    padding: 0.5rem !important;
  }

  .rtl .stock-stat-value {
    font-size: 1.1rem !important;
  }
}

/* RTL Mobile Inventory Layout - Critical Fixes */
@media (max-width: 768px) {

  /* RTL Inventory Container */
  .rtl #inventory-content {
    direction: rtl !important;
    text-align: right !important;
    padding: 0 1rem !important;
  }

  /* RTL Inventory Header */
  .rtl .inventory-header {
    direction: rtl !important;
    text-align: right !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  .rtl .inventory-header h1 {
    text-align: right !important;
    margin: 0 !important;
  }

  .rtl .inventory-header p {
    text-align: right !important;
    margin: 0.5rem 0 0 0 !important;
  }

  /* RTL Inventory Search */
  .rtl .inventory-search {
    direction: rtl !important;
    flex-direction: row-reverse !important;
    width: 100% !important;
  }

  .rtl .inventory-search .search-input {
    text-align: right !important;
    direction: rtl !important;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem !important;
    width: 100% !important;
  }

  .rtl .inventory-search .search-input::placeholder {
    text-align: right !important;
    direction: rtl !important;
  }

  /* RTL Search Icon Position */
  .rtl .inventory-search .search-icon {
    right: auto !important;
    left: 0.75rem !important;
    position: absolute !important;
  }

  /* RTL Inventory Actions */
  .rtl .inventory-actions {
    direction: rtl !important;
    flex-direction: row-reverse !important;
    gap: 0.5rem !important;
    justify-content: flex-start !important;
    margin-top: 0.5rem !important;
  }

  /* RTL Inventory Widget Grid */
  .rtl .inventory-widget-grid {
    direction: rtl !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* RTL Widget Cards */
  .rtl .stock-overview-widget,
  .rtl .low-stock-widget,
  .rtl .movements-widget,
  .rtl .warehouse-card,
  .rtl .quick-action-card {
    direction: rtl !important;
    text-align: right !important;
    padding: 1rem !important;
  }

  /* RTL Widget Headers */
  .rtl .widget-header {
    direction: rtl !important;
    text-align: right !important;
    flex-direction: row-reverse !important;
    justify-content: space-between !important;
  }

  .rtl .widget-title {
    text-align: right !important;
    margin: 0 0 0.25rem 0 !important;
  }

  .rtl .widget-subtitle {
    text-align: right !important;
    margin: 0 !important;
  }

  .rtl .widget-actions {
    direction: rtl !important;
    flex-direction: row-reverse !important;
  }

  /* RTL Stock Stats Grid */
  .rtl .stock-stats {
    direction: rtl !important;
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  .rtl .stock-stat {
    text-align: center !important;
    padding: 0.75rem !important;
  }

  .rtl .stock-stat-value {
    direction: ltr !important;
    unicode-bidi: embed !important;
    display: inline-block !important;
  }

  .rtl .stock-stat-label {
    text-align: center !important;
    margin-top: 0.25rem !important;
  }

  /* RTL Low Stock List */
  .rtl .low-stock-list {
    direction: rtl !important;
    max-height: 200px !important;
  }

  .rtl .low-stock-item {
    direction: rtl !important;
    text-align: right !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.75rem !important;
  }

  .rtl .low-stock-info {
    text-align: right !important;
    margin-bottom: 0.5rem !important;
  }

  .rtl .low-stock-product {
    text-align: right !important;
  }

  .rtl .low-stock-details {
    text-align: right !important;
  }

  .rtl .low-stock-quantity {
    text-align: center !important;
    margin-right: 0 !important;
  }

  .rtl .current-qty,
  .rtl .reorder-point {
    direction: ltr !important;
    unicode-bidi: embed !important;
  }

  /* RTL Warehouse Cards */
  .rtl .warehouse-cards-grid {
    direction: rtl !important;
    grid-template-columns: 1fr !important;
  }

  .rtl .warehouse-card {
    direction: rtl !important;
    text-align: right !important;
  }

  .rtl .warehouse-header {
    direction: rtl !important;
    text-align: right !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .rtl .warehouse-info {
    text-align: right !important;
  }

  .rtl .warehouse-info h3 {
    text-align: right !important;
    margin: 0 0 0.25rem 0 !important;
  }

  .rtl .warehouse-code {
    text-align: right !important;
    direction: ltr !important;
    unicode-bidi: embed !important;
  }

  .rtl .warehouse-location {
    text-align: right !important;
  }

  .rtl .warehouse-icon {
    margin: 0 auto 0.5rem auto !important;
  }

  /* RTL Warehouse Stats */
  .rtl .warehouse-stats {
    direction: rtl !important;
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  .rtl .warehouse-stat {
    text-align: center !important;
    padding: 0.5rem !important;
  }

  .rtl .warehouse-stat-value {
    direction: ltr !important;
    unicode-bidi: embed !important;
  }

  .rtl .warehouse-stat-label {
    text-align: center !important;
  }

  /* RTL Warehouse Actions */
  .rtl .warehouse-actions {
    direction: rtl !important;
    flex-direction: row-reverse !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 0.375rem !important;
  }

  .rtl .warehouse-action-btn {
    flex: 1 !important;
    text-align: center !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
  }

  /* RTL Purchase/Sales Cards */
  .rtl .purchase-sales-cards {
    direction: rtl !important;
    grid-template-columns: 1fr !important;
  }

  .rtl .quick-action-card {
    direction: rtl !important;
    text-align: right !important;
  }

  .rtl .quick-action-title {
    text-align: right !important;
  }

  .rtl .quick-action-description {
    text-align: right !important;
  }

  /* RTL Movement List */
  .rtl .movements-list {
    direction: rtl !important;
    max-height: 200px !important;
  }

  .rtl .movement-item {
    direction: rtl !important;
    flex-direction: row-reverse !important;
    text-align: right !important;
  }

  .rtl .movement-type-badge {
    order: 1 !important;
    margin-left: 0 !important;
    margin-right: 1rem !important;
  }

  .rtl .movement-info {
    order: 2 !important;
    text-align: right !important;
    flex: 1 !important;
  }

  .rtl .movement-quantity {
    order: 3 !important;
    text-align: left !important;
    direction: ltr !important;
    unicode-bidi: embed !important;
    margin-left: 1rem !important;
  }

  .rtl .movement-description {
    text-align: right !important;
  }

  .rtl .movement-details {
    text-align: right !important;
  }

  /* RTL Buttons and Actions */
  .rtl .btn {
    direction: rtl !important;
    text-align: center !important;
  }

  .rtl .reorder-btn {
    text-align: center !important;
  }

  .rtl .inventory-row-btn {
    text-align: center !important;
  }

  /* RTL Forms and Inputs */
  .rtl .form-group {
    text-align: right !important;
  }

  .rtl .form-label {
    text-align: right !important;
  }

  .rtl .form-input,
  .rtl .form-select,
  .rtl .form-textarea {
    text-align: right !important;
    direction: rtl !important;
  }

  .rtl .form-input[type="number"] {
    text-align: left !important;
    direction: ltr !important;
    unicode-bidi: embed !important;
  }

  /* RTL Tables */
  .rtl .inventory-table {
    direction: rtl !important;
  }

  .rtl .inventory-table th,
  .rtl .inventory-table td {
    text-align: right !important;
  }

  .rtl .inventory-table .inventory-row-actions {
    direction: rtl !important;
    flex-direction: row-reverse !important;
    justify-content: center !important;
  }

  /* RTL Modals */
  .rtl .modal-content {
    direction: rtl !important;
    text-align: right !important;
  }

  .rtl .modal-header {
    direction: rtl !important;
    flex-direction: row-reverse !important;
  }

  .rtl .modal-title {
    text-align: right !important;
  }

  .rtl .modal-footer {
    direction: rtl !important;
    flex-direction: row-reverse !important;
  }

  /* RTL Warehouse Panel */
  .rtl .warehouse-side-panel {
    right: auto !important;
    left: 0 !important;
    direction: rtl !important;
    transform: translateX(-100%) !important;
  }

  .rtl .warehouse-side-panel.open {
    transform: translateX(0) !important;
  }

  .rtl .panel-header {
    direction: rtl !important;
    flex-direction: row-reverse !important;
  }

  .rtl .panel-title {
    text-align: right !important;
  }

  .rtl .panel-subtitle {
    text-align: right !important;
  }

  .rtl .panel-tabs {
    direction: rtl !important;
    flex-direction: row-reverse !important;
  }

  .rtl .panel-content {
    direction: rtl !important;
    text-align: right !important;
  }

  /* RTL Toast Notifications */
  .rtl .toast {
    right: auto !important;
    left: 2rem !important;
    direction: rtl !important;
    text-align: right !important;
  }
}

/* RTL Mobile - Small Screens (480px and below) */
@media (max-width: 480px) {
  .rtl #inventory-content {
    padding: 0 0.75rem !important;
  }

  .rtl .inventory-header {
    padding: 0.75rem !important;
  }

  .rtl .stock-overview-widget,
  .rtl .low-stock-widget,
  .rtl .movements-widget,
  .rtl .warehouse-card,
  .rtl .quick-action-card {
    padding: 0.75rem !important;
  }

  .rtl .warehouse-action-btn {
    font-size: 0.7rem !important;
    padding: 0.375rem 0.5rem !important;
  }

  .rtl .warehouse-side-panel {
    width: 100vw !important;
    height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    transform: translateX(-100%) !important;
  }

  .rtl .warehouse-side-panel.open {
    transform: translateX(0) !important;
  }
}