/* ==========================================================================
   Jerii.made Studio - Modern Artisan Back-Office System
   Aesthetic: Luxury Dark Craft Studio with Terracotta, Gold & Sage Accents
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Tokens */
  --bg-main: #0b0f17;
  --bg-card: rgba(19, 26, 42, 0.75);
  --bg-card-hover: rgba(28, 38, 62, 0.85);
  --bg-modal: #111827;
  --border-card: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(224, 122, 95, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-terracotta: #e07a5f;
  --accent-terracotta-glow: rgba(224, 122, 95, 0.2);
  --accent-peach: #f4a261;
  --accent-sage: #81b29a;
  --accent-sage-glow: rgba(129, 178, 154, 0.2);
  --accent-gold: #f2cc8f;
  --accent-danger: #ef4444;
  --accent-info: #38bdf8;
  --accent-purple: #a855f7;

  /* Typography */
  --font-family: 'Plus Jakarta Sans', 'Prompt', -apple-system, sans-serif;

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --backdrop-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(224, 122, 95, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(129, 178, 154, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(242, 204, 143, 0.04) 0px, transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Top App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-card);
  padding: 1rem 2rem;
  padding-top: calc(1rem + env(safe-area-inset-top, 0px));
  padding-left: calc(2rem + env(safe-area-inset-left, 0px));
  padding-right: calc(2rem + env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-badge {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-terracotta), var(--accent-peach));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-terracotta-glow);
}

.brand-title-group h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-title-group h1 span.tagline {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  background: rgba(224, 122, 95, 0.15);
  color: var(--accent-peach);
  border: 1px solid rgba(224, 122, 95, 0.3);
  border-radius: var(--radius-full);
}

.brand-title-group p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Navigation Tabs Bar */
.nav-tab-container {
  padding: 0.75rem 2rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-card);
  overflow-x: auto;
  white-space: nowrap;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, rgba(224, 122, 95, 0.2), rgba(244, 162, 97, 0.15));
  color: #fff;
  border: 1px solid rgba(224, 122, 95, 0.4);
  box-shadow: 0 2px 10px rgba(224, 122, 95, 0.2);
}

.nav-tab-btn .badge-pill {
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-danger);
  color: white;
}

/* Main Container */
.main-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.75rem 2rem 4rem;
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stat KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: var(--backdrop-blur);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-terracotta);
}

.kpi-card.green::before { background: var(--accent-sage); }
.kpi-card.gold::before { background: var(--accent-gold); }
.kpi-card.blue::before { background: var(--accent-info); }
.kpi-card.purple::before { background: var(--accent-purple); }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.kpi-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.kpi-icon {
  font-size: 1.1rem;
  opacity: 0.8;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Card Sections */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: var(--backdrop-blur);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.card-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title-bar h2 {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-terracotta), var(--accent-peach));
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-terracotta-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-card);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-success {
  background: var(--accent-sage);
  color: #0b1510;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.86rem;
}

table.data-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-card);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

/* Material Master Compact Responsive Styling (Fits screen without horizontal scroll) */
#tab-materials .table-responsive {
  overflow-x: auto;
  max-width: 100%;
}

#tab-materials .data-table {
  width: 100% !important;
  font-size: 0.78rem;
  border-collapse: collapse;
}

#tab-materials .data-table th {
  padding: 0.5rem 0.25rem !important;
  white-space: normal !important;
  text-align: center;
  line-height: 1.2;
  font-size: 0.74rem;
  font-weight: 700;
  vertical-align: middle;
  letter-spacing: -0.2px;
}

#tab-materials .data-table td {
  padding: 0.45rem 0.25rem !important;
  vertical-align: middle;
}

#tab-materials .mat-thumb-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  margin: 0 auto;
}

#tab-materials .mat-thumb-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

#tab-materials .mat-action-btns {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
}

#tab-materials .mat-action-btns .btn-sm {
  padding: 0.22rem 0.35rem !important;
  font-size: 0.7rem !important;
  border-radius: 4px;
  white-space: nowrap;
}

/* Material Table High-Contrast Typography & Theming */
.mat-cell-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.mat-cell-stock {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.mat-cell-stock.stock-low {
  color: var(--accent-danger) !important;
  font-weight: 800;
}

.mat-cell-minstock {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 500;
}

.mat-cell-buycost {
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  font-weight: 700;
}

.mat-cell-unitcost {
  color: #10b981;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  font-weight: 700;
}

.mat-cell-totalval {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.82rem;
}

.mat-unit-badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-block;
  white-space: nowrap;
}

/* High-Contrast Colors for Light Theme */
body.theme-light .mat-cell-unitcost {
  color: #047857 !important; /* Deep Emerald - highly readable on white */
}

body.theme-light .mat-cell-buycost {
  color: #b45309 !important; /* Deep Amber Bronze - highly readable on white */
}

body.theme-light .mat-cell-minstock {
  color: #475569 !important; /* Slate-600 */
}

body.theme-light .mat-unit-badge {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

body.theme-light table.data-table td code {
  color: #475569 !important;
  background: #f1f5f9;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

@media (max-width: 1024px) {
  #tab-materials .glass-card {
    padding: 1rem !important;
  }
}

/* Tags and Badges */
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.tag-clay { background: rgba(244, 162, 97, 0.15); color: #f4a261; border: 1px solid rgba(244, 162, 97, 0.3); }
.tag-finishing { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.tag-comp { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.tag-pack { background: rgba(129, 178, 154, 0.15); color: #81b29a; border: 1px solid rgba(129, 178, 154, 0.3); }
.tag-color { background: rgba(242, 204, 143, 0.15); color: #f2cc8f; border: 1px solid rgba(242, 204, 143, 0.3); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.status-ok { background: rgba(129, 178, 154, 0.15); color: #81b29a; }
.status-warning { background: rgba(244, 162, 97, 0.15); color: #f4a261; }
.status-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Product Cards Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.product-card:hover {
  border-color: var(--accent-terracotta);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.product-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.product-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.product-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.cost-breakdown-box {
  background: rgba(11, 15, 23, 0.6);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

.sim-defect-edit-input {
  width: 82px;
  text-align: right;
  font-size: 0.82rem !important;
  padding: 0.15rem 0.35rem !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  height: 26px !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  background: rgba(245, 158, 11, 0.08) !important;
  transition: var(--transition-fast);
}

.sim-defect-edit-input:focus {
  outline: none;
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.15) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25) !important;
}

body.theme-light .sim-defect-edit-input {
  color: #b45309 !important;
  border: 1px solid #fcd34d !important;
  background: #fef3c7 !important;
}

.cost-row.highlight {
  color: var(--text-primary);
  font-weight: 600;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  margin-top: 0.4rem;
}

.product-pricing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-card);
}

.price-box .price-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.price-box .price-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-peach);
}

.margin-pill {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(129, 178, 154, 0.2);
  color: #a7f3d0;
  border: 1px solid rgba(129, 178, 154, 0.4);
}

/* Modal Form Styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

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

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.close-modal-btn:hover { color: #fff; }

.modal-body {
  padding: 1.5rem 1.75rem;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 3px var(--accent-terracotta-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--border-card);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Custom Interactive BOM Builder */
.bom-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

/* Alerts Banner */
.alert-banner {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.alert-warning {
  background: rgba(244, 162, 97, 0.12);
  border: 1px solid rgba(244, 162, 97, 0.3);
  color: #f4a261;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .app-header { padding: 1rem; flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .header-actions { width: 100%; justify-content: space-between; }
  .nav-tab-container { padding: 0.5rem 1rem; }
  .main-wrapper { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - 3rem);
}

.toast-item {
  pointer-events: auto;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.toast-item.hide {
  opacity: 0;
  transform: translateX(100%);
}

.toast-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-sage);
}

.toast-item.info::before { background: var(--accent-info); }
.toast-item.danger::before { background: var(--accent-danger); }
.toast-item.warning::before { background: var(--accent-peach); }

.toast-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.toast-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  line-height: 1;
}

.toast-close-btn:hover { color: #fff; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   Table Row Pulse & Temporary Stock Change Badge
   ========================================================================== */
.row-highlight-pulse {
  animation: rowPulse 2.5s ease-out;
}

@keyframes rowPulse {
  0% { background-color: rgba(129, 178, 154, 0.35); box-shadow: inset 0 0 12px rgba(129, 178, 154, 0.4); }
  50% { background-color: rgba(129, 178, 154, 0.15); }
  100% { background-color: transparent; }
}

.stock-change-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.45rem;
  padding: 0.15rem 0.5rem;
  background: rgba(129, 178, 154, 0.25);
  color: #a7f3d0;
  border: 1px solid rgba(129, 178, 154, 0.5);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  animation: badgePop 0.35s cubic-bezier(0.16, 1, 0.3, 1), fadeOutBadge 0.5s ease forwards 4.5s;
}

@keyframes badgePop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeOutBadge {
  to { opacity: 0; transform: scale(0.8); }
}

/* ==========================================================================
   Material Thumbnail Avatars & Hover Zoom
   ========================================================================== */
.mat-thumb-wrapper {
  width: 50px;
  height: 50px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mat-thumb-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #111722;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.24s ease, border-color 0.24s ease;
  cursor: pointer;
  display: block;
}

.mat-thumb-img:hover {
  transform: scale(2.65);
  z-index: 120;
  position: relative;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.85);
  border-color: var(--accent-peach);
}

.mat-thumb-fallback {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   BOM Simulator Item Rows
   ========================================================================== */
.bom-item-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.65rem !important;
  padding: 0.5rem 0.65rem !important;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.bom-item-row select {
  flex: 1 1 auto !important;
  min-width: 150px;
}

.bom-item-row input[type="number"] {
  width: 80px !important;
  flex: 0 0 80px !important;
}

.bom-item-row button {
  flex: 0 0 auto !important;
  width: auto !important;
  padding: 0.35rem 0.75rem !important;
}

/* ==========================================================================
   Product Images & Upload Dropzones
   ========================================================================== */
.product-card-img-wrapper {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.product-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
}

.product-card:hover .product-card-img {
  transform: scale(1.06);
}

.product-card-img-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Modal Image Dropzone */
.image-upload-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.image-upload-dropzone:hover,
.image-upload-dropzone.dragover {
  border-color: var(--accent-peach);
  background: rgba(235, 148, 126, 0.08);
}

.upload-placeholder-content .upload-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 0.35rem;
}

.upload-placeholder-content .upload-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.upload-placeholder-content .upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.upload-preview-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.upload-preview-img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* BOM Simulator Image Editor */
.sim-image-editor-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.sim-product-image-box {
  width: 100%;
  height: 150px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(11, 15, 23, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.sim-product-image-box:hover {
  border-color: var(--accent-peach);
  background: rgba(235, 148, 126, 0.06);
}

.sim-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sim-img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ==================== POS SYSTEM STYLES ==================== */
.pos-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.pos-mode-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  gap: 4px;
}

.pos-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.pos-mode-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.pos-mode-btn.active {
  background: var(--bg-elevated);
  color: var(--accent-peach);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pos-workstation {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .pos-workstation {
    grid-template-columns: 1fr;
  }
}

.pos-catalog-panel {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pos-catalog-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pos-quick-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.pos-catalog-content {
  display: grid;
  grid-template-columns: 165px 1fr;
  gap: 0.9rem;
  align-items: start;
}

@media (max-width: 900px) {
  .pos-catalog-content {
    grid-template-columns: 1fr;
  }
  .pos-category-sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .pos-cat-sidebar-title {
    display: none;
  }
}

.pos-category-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.65rem;
}

.pos-cat-sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0.2rem 0.4rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0.25rem;
}

.pos-cat-pill {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: all 0.18s ease;
  text-align: left;
}

.pos-cat-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(2px);
}

.pos-cat-pill.active {
  background: rgba(244, 162, 97, 0.15);
  color: var(--accent-peach);
  font-weight: 700;
  border-color: var(--accent-peach);
  box-shadow: 0 2px 10px rgba(244, 162, 97, 0.25);
}

.pos-cat-count {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-weight: 700;
}

.pos-cat-pill.active .pos-cat-count {
  background: var(--accent-peach);
  color: #1a1615;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
}

.pos-product-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  position: relative;
  user-select: none;
}

.pos-product-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-peach);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.pos-product-card.out-of-stock {
  opacity: 0.65;
}

.pos-card-img-wrapper {
  width: 100%;
  height: 110px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
}

.pos-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.pos-product-card:hover .pos-card-img {
  transform: scale(1.06);
}

.pos-stock-tag {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.pos-stock-ok {
  background: rgba(16, 185, 129, 0.85);
  color: #fff;
}

.pos-stock-low {
  background: rgba(245, 158, 11, 0.85);
  color: #fff;
}

.pos-stock-none {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
}

.pos-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.2em;
}

.pos-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.35rem;
}

.pos-card-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-peach);
}

.pos-add-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s;
}

.pos-product-card:hover .pos-add-btn {
  background: var(--accent-peach);
  color: #1a1615;
  border-color: var(--accent-peach);
}

/* POS Cart Panel */
.pos-cart-panel {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.pos-cart-items-wrapper {
  min-height: 180px;
  max-height: 270px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  border-top: 1px solid var(--border-card);
  border-bottom: 1px solid var(--border-card);
  padding: 0.5rem 0;
}

.pos-cart-empty {
  text-align: center;
  padding: 2.5rem 1rem;
}

.pos-cart-item-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.pos-cart-item-row:last-child {
  border-bottom: none;
}

.pos-cart-item-img {
  width: 38px;
  height: 38px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.pos-cart-item-info {
  flex: 1;
  min-width: 0;
}

.pos-cart-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.pos-cart-item-unit-price {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pos-cart-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  border: 1px solid var(--border-card);
  padding: 2px;
}

.pos-stepper-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s;
}

.pos-stepper-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.pos-stepper-input {
  width: 28px;
  background: transparent;
  border: none;
  text-align: center;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  outline: none;
}

.pos-cart-item-subtotal {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-peach);
  min-width: 60px;
  text-align: right;
}

.pos-cart-item-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.pos-cart-item-remove:hover {
  color: var(--accent-danger);
}

/* POS Summary */
.pos-summary-box {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-card);
}

.pos-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

.pos-summary-row.total-row {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pos-pay-method-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.pos-pay-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 0.4rem 0.2rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.pos-pay-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.pos-pay-btn.active {
  background: rgba(244, 162, 97, 0.15);
  border-color: var(--accent-peach);
  color: var(--accent-peach);
  font-weight: 700;
}

.pos-payment-details-box {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  padding: 0.75rem;
}

/* Digital Receipt Paper */
.receipt-paper {
  background: #181d28;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Jerii.made Studio - White Theme (Light Mode / Warm Artisan Paper)
   ========================================================================== */
body.theme-light {
  --bg-main: #f4f6f9;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfcfd;
  --bg-modal: #ffffff;
  --border-card: #e2e8f0;
  --border-glow: rgba(224, 122, 95, 0.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-terracotta: #d95d39;
  --accent-terracotta-glow: rgba(217, 93, 57, 0.18);
  --accent-peach: #e76f51;
  --accent-sage: #0d9488;
  --accent-sage-glow: rgba(13, 148, 136, 0.15);
  --accent-gold: #d97706;
  --accent-danger: #ef4444;
  --accent-info: #0284c7;
  --accent-purple: #7c3aed;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.09);

  background-color: #f4f6f9;
  background-image: 
    radial-gradient(at 0% 0%, rgba(224, 122, 95, 0.07) 0px, transparent 45%),
    radial-gradient(at 100% 100%, rgba(13, 148, 136, 0.05) 0px, transparent 45%),
    radial-gradient(at 50% 50%, rgba(217, 119, 6, 0.03) 0px, transparent 55%);
  color: var(--text-primary);
}

/* Header & Navigation in Light Theme */
body.theme-light .app-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

body.theme-light .brand-title-group h1 {
  color: #0f172a;
}

body.theme-light .tagline {
  background: rgba(224, 122, 95, 0.1);
  color: var(--accent-terracotta);
  border-color: rgba(224, 122, 95, 0.25);
}

body.theme-light .nav-tab-container {
  background: rgba(255, 255, 255, 0.88);
  border-bottom-color: #e2e8f0;
}

body.theme-light .nav-tabs {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.theme-light .nav-tab-btn {
  color: #475569;
}

body.theme-light .nav-tab-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}

body.theme-light .nav-tab-btn.active {
  background: #ffffff;
  color: var(--accent-terracotta);
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Cards & Containers in Light Theme */
body.theme-light .glass-card,
body.theme-light .kpi-card,
body.theme-light .product-card,
body.theme-light .modal-content {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

body.theme-light .kpi-value,
body.theme-light .product-name,
body.theme-light .modal-header h3,
body.theme-light .card-title-bar h2,
body.theme-light h1, body.theme-light h2, body.theme-light h3 {
  color: #0f172a;
}

/* Form Inputs in Light Theme */
body.theme-light .form-control {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

body.theme-light .form-control:focus {
  background: #ffffff;
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.15);
}

body.theme-light .form-control::placeholder {
  color: #94a3b8;
}

/* Tables in Light Theme */
body.theme-light table.data-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
}

body.theme-light table.data-table td {
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

body.theme-light table.data-table tr:hover td {
  background: #f8fafc;
}

/* Buttons in Light Theme */
body.theme-light .btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

body.theme-light .btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Cost Simulator Boxes in Light Theme */
body.theme-light .cost-breakdown-box,
body.theme-light .sim-calc-result-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

/* POS System in Light Theme */
body.theme-light .pos-mode-switcher {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

body.theme-light .pos-mode-btn {
  color: #475569;
}

body.theme-light .pos-mode-btn:hover {
  color: #0f172a;
}

body.theme-light .pos-mode-btn.active {
  background: #ffffff;
  color: var(--accent-peach);
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.theme-light .pos-quick-stat {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.theme-light .pos-category-sidebar {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.theme-light .pos-cat-pill {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
}

body.theme-light .pos-cat-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

body.theme-light .pos-cat-pill.active {
  background: rgba(244, 162, 97, 0.15);
  border-color: var(--accent-peach);
  color: var(--accent-peach);
}

body.theme-light .pos-cat-count {
  background: #f1f5f9;
  color: #64748b;
}

body.theme-light .pos-product-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

body.theme-light .pos-product-card:hover {
  background: #ffffff;
  border-color: var(--accent-peach);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}

body.theme-light .pos-card-title {
  color: #0f172a;
}

body.theme-light .pos-cart-items-wrapper {
  background: #fcfcfd;
  border-color: #e2e8f0;
}

body.theme-light .pos-cart-item-row {
  border-bottom-color: #f1f5f9;
}

body.theme-light .pos-cart-item-row:hover {
  background: #f8fafc;
}

body.theme-light .pos-cart-item-name {
  color: #0f172a;
}

body.theme-light .pos-stepper-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

body.theme-light .pos-stepper-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

body.theme-light .pos-stepper-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.theme-light .pos-summary-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.theme-light .pos-pay-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

body.theme-light .pos-pay-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

body.theme-light .pos-pay-btn.active {
  background: rgba(244, 162, 97, 0.15);
  border-color: var(--accent-peach);
  color: var(--accent-peach);
}

body.theme-light .pos-payment-details-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.theme-light .receipt-paper {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

body.theme-light .receipt-paper table thead tr {
  border-bottom-color: #cbd5e1 !important;
}

body.theme-light .receipt-paper table tbody tr {
  border-bottom-color: #f1f5f9 !important;
}

/* Theme Toggle Button: Mode Night (in white theme) / Mode Daytime (in dark theme) */
#btnThemeToggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

/* When screen is dark (Night Mode): button is crisp white */
body.theme-dark #btnThemeToggle,
body:not(.theme-light) #btnThemeToggle {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #ffffff !important;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.25) !important;
}

body.theme-dark #btnThemeToggle:hover,
body:not(.theme-light) #btnThemeToggle:hover {
  background: #f1f5f9 !important;
  color: #000000 !important;
  transform: translateY(-1px);
}

/* When screen is white (Light Mode): button shows Mode Night with dark contrast pill */
body.theme-light #btnThemeToggle {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

body.theme-light #btnThemeToggle:hover {
  background: #0f172a !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* ==================== GLOBAL HIGH-CONTRAST THEME RULES ==================== */
/* 1. Margin & Profit Pills */
.margin-pill {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

body.theme-light .margin-pill {
  background: #dcfce7 !important;
  color: #15803d !important; /* Deep forest green */
  border: 1px solid #86efac !important;
}

.sim-profit-value,
.profit-positive {
  color: #6ee7b7;
  font-weight: 700;
}

body.theme-light .sim-profit-value,
body.theme-light .profit-positive {
  color: #047857 !important; /* Deep emerald - super crisp */
}

/* 2. BOM and Sales Item Badges */
.bom-pill,
.sale-item-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin: 2px 2px 2px 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.theme-light .bom-pill,
body.theme-light .sale-item-badge {
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}

/* 3. Defect & Scrap Tags */
.defect-tag-damage {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.defect-tag-decrease {
  background: rgba(244, 162, 97, 0.18);
  color: #f4a261;
  border: 1px solid rgba(244, 162, 97, 0.35);
}

.defect-tag-increase {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.defect-val-decrease {
  color: var(--accent-danger);
  font-weight: 700;
}

.defect-val-increase {
  color: #10b981;
  font-weight: 700;
}

body.theme-light .defect-tag-damage {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}

body.theme-light .defect-tag-decrease {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #fcd34d !important;
}

body.theme-light .defect-tag-increase {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}

body.theme-light .defect-val-decrease {
  color: #dc2626 !important;
}

body.theme-light .defect-val-increase {
  color: #15803d !important;
}

/* 4. Cost Row Details in Light Mode */
body.theme-light .cost-breakdown-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}

body.theme-light .cost-row {
  color: #334155 !important;
  font-weight: 500;
  font-size: 0.85rem;
}

body.theme-light .cost-row span:first-child {
  color: #334155 !important;
  font-weight: 600 !important;
}

body.theme-light .cost-row span:last-child {
  color: #0f172a !important;
  font-weight: 700 !important;
}

body.theme-light .cost-row.highlight span:first-child {
  color: #0f172a !important;
  font-weight: 700 !important;
}

body.theme-light .cost-row.highlight span:last-child {
  color: #c2410c !important;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
}

body.theme-light #simResultTotalCost {
  color: #c2410c !important;
  font-size: 1.2rem !important;
  font-weight: 800 !important;
}

/* 5. Product Pricing & POS Text in Light Mode */
body.theme-light .price-box {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
}

body.theme-light .price-box .price-label {
  color: #475569 !important;
  font-weight: 600 !important;
}

body.theme-light .price-box .price-value {
  color: #c2410c !important; /* Deep terracotta/peach */
  font-weight: 800 !important;
}

body.theme-light .pos-card-price {
  color: #c2410c !important;
  font-weight: 800 !important;
}

body.theme-light .pos-cart-item-name {
  color: #0f172a !important;
  font-weight: 700 !important;
}

body.theme-light .pos-cart-item-unit-price {
  color: #475569 !important;
  font-weight: 600 !important;
}

body.theme-light .pos-cart-item-subtotal {
  color: #0f172a !important;
  font-weight: 800 !important;
}

body.theme-light #posGrandTotal {
  color: #c2410c !important;
  font-size: 1.45rem !important;
  font-weight: 800 !important;
}

/* 6. General Tables & Headers Light Contrast */
body.theme-light table.data-table th {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

body.theme-light table.data-table td strong {
  color: #0f172a !important;
}

body.theme-light table.data-table td code {
  color: #334155 !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  font-weight: 600;
}

body.theme-light .kpi-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

body.theme-light .kpi-title {
  color: #334155 !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
}

body.theme-light .kpi-value {
  color: #0f172a !important;
  font-weight: 800 !important;
}

body.theme-light .kpi-subtext {
  color: #475569 !important;
  font-weight: 500 !important;
}

body.theme-light .card-subtitle {
  color: #475569 !important;
  font-weight: 500;
}

body.theme-light h4 {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* 7. BOM Simulator Daytime / Night Dedicated Overhauls */
.sim-pricing-card {
  background: rgba(11, 15, 23, 0.7);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

.sim-section-title {
  margin-bottom: 0.85rem;
  color: var(--accent-gold);
  font-size: 1.05rem;
  font-weight: 700;
}

.sim-widget-header {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-peach);
}

.sim-muted-note {
  color: var(--text-muted);
}

.sim-placeholder-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.sim-placeholder-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.2rem;
}

.bom-item-subtotal {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-sage);
  min-width: 75px;
  text-align: right;
}

/* Light Mode Overrides for BOM Simulator */
body.theme-light .sim-pricing-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
}

body.theme-light .sim-section-title {
  color: #c2410c !important; /* Rich terracotta orange - ultra clear on white */
  font-weight: 700 !important;
}

body.theme-light .sim-widget-header {
  color: #9a3412 !important;
}

body.theme-light .sim-muted-note {
  color: #475569 !important;
  font-weight: 500 !important;
}

body.theme-light .sim-image-editor-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.theme-light .sim-product-image-box {
  background: #ffffff !important;
  border: 1.5px dashed #cbd5e1 !important;
}

body.theme-light .sim-product-image-box:hover {
  background: #fff7ed !important;
  border-color: #ea580c !important;
}

body.theme-light .sim-placeholder-text {
  color: #334155 !important;
  font-weight: 600 !important;
}

body.theme-light .sim-placeholder-sub {
  color: #64748b !important;
}

body.theme-light .bom-item-row {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.theme-light .bom-item-row select,
body.theme-light .bom-item-row input[type="number"] {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}

body.theme-light .bom-item-subtotal {
  color: #047857 !important; /* Deep emerald in light mode */
  font-weight: 700 !important;
}

body.theme-light .form-label {
  color: #0f172a !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
}

body.theme-light .form-control {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}

body.theme-light .form-control:focus {
  border-color: #ea580c !important;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15) !important;
}

/* 8. Alert Banners in Light Mode */
body.theme-light .alert-warning {
  background: #fef3c7 !important;
  border: 1px solid #fcd34d !important;
  color: #92400e !important;
}

body.theme-light .alert-warning strong {
  color: #78350f !important;
}

body.theme-light .alert-info {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  color: #1e40af !important;
}

/* 9. Analytics Chart Headers */
body.theme-light #chartGrid h3 {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* 10. Cloud Sync Header Badge & Modal Styles */
#btnCloudSync {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

#btnCloudSync.syncing {
  border-color: #38bdf8;
  color: #38bdf8;
  animation: pulseSync 1.5s infinite;
}

#btnCloudSync.synced {
  border-color: #10b981;
  color: #10b981;
}

#btnCloudSync.offline {
  border-color: #f59e0b;
  color: #f59e0b;
}

body.theme-light #btnCloudSync.synced {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border: 1px solid #a7f3d0 !important;
}

body.theme-light #btnCloudSync.syncing {
  background: #f0f9ff !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
}

body.theme-light #btnCloudSync.offline {
  background: #fefce8 !important;
  color: #a16207 !important;
  border: 1px solid #fef08a !important;
}

body.theme-light .cloud-sync-status-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.theme-light .cloud-autosync-row {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

@keyframes pulseSync {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}





