.mfg-container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.mfg-page-card { background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); border: 1px solid #e5e7eb; padding: 24px; margin-bottom: 20px; }
.page-header h1 { font-size: 1.75rem; color: #1a5f7a; margin: 0 0 8px 0; display: flex; align-items: center; gap: 10px; }
.page-header h1 i { color: #1a5f7a; }
.page-header p { color: #6b7280; margin: 0; font-size: 0.95rem; }
.mfg-inventory-page .table-section { padding: 0; overflow: hidden; }
.mfg-inventory-page .table-section .mfg-table { box-shadow: none; border-radius: 0; border: none; }
.inventory-filter-section { padding: 20px 24px; }
.inventory-filter-form { margin: 0; }
.filter-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.filter-row .form-group { margin: 0; flex: 0 1 220px; min-width: 160px; }
.filter-row .btn-filter { flex-shrink: 0; }
.mfg-back-link { margin-top: 24px; margin-bottom: 0; }
.mfg-back-link a { color: #7c3aed; text-decoration: underline; font-size: 0.95rem; }
.mfg-back-link a:hover { color: #6d28d9; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); text-align: center; }
.stat-card.alert { border: 1px solid #f59e0b; background: #fffbeb; }
.stat-icon { font-size: 1.5rem; color: #1a5f7a; margin-bottom: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: #6b7280; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.link-card { display: flex; flex-direction: column; align-items: center; padding: 20px; background: #fff; border-radius: 12px; text-decoration: none; color: inherit; border: 1px solid #e5e7eb; transition: all 0.2s; }
.link-card:hover { border-color: #1a5f7a; box-shadow: 0 4px 12px rgba(26,95,122,0.15); }
.link-card i { font-size: 1.75rem; color: #1a5f7a; margin-bottom: 10px; }
.link-card span { font-weight: 600; }
.link-card small { font-size: 0.75rem; color: #6b7280; margin-top: 4px; }
.mfg-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.mfg-table th, .mfg-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e5e7eb; }
.mfg-table th { background: #f8fafc; font-weight: 600; }
.mfg-table-empty { text-align: center; padding: 32px 24px !important; color: #6b7280; background: #f8fafc; }
.mfg-table-empty a { color: #1a5f7a; font-weight: 500; text-decoration: none; }
.mfg-table-empty a:hover { text-decoration: underline; }
.mfg-table td:last-child { white-space: nowrap; }
.mfg-table td:last-child a + a { margin-left: 8px; }
.mfg-table-actions { white-space: nowrap; min-width: 200px; }
.mfg-table-actions .btn-sm { padding: 6px 10px; font-size: 0.85rem; text-decoration: none; display: inline-block; border-radius: 6px; font-weight: 500; margin-right: 6px; }
.mfg-table-actions .btn-sm:last-child { margin-right: 0; }
/* Edit and Delete: icon only, no background */
.mfg-table-actions .btn-edit,
.mfg-table-actions .btn-delete,
.btn-edit, .btn-delete,
.btn-bom-edit, .btn-bom-delete,
a.btn-edit, a.btn-delete {
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  color: #1a5f7a !important;
  padding: 4px 8px !important;
}
.btn-delete, .btn-bom-delete, a.btn-delete { color: #dc2626 !important; }
.mfg-table-actions .btn-edit:hover, .btn-edit:hover, .btn-bom-edit:hover, a.btn-edit:hover,
.mfg-table-actions .btn-edit:focus, .btn-edit:focus, .btn-bom-edit:focus, a.btn-edit:focus {
  color: #007bb8 !important;
  background: none !important;
  background-color: transparent !important;
}
.mfg-table-actions .btn-delete:hover, .btn-delete:hover, .btn-bom-delete:hover, a.btn-delete:hover,
.mfg-table-actions .btn-delete:focus, .btn-delete:focus, .btn-bom-delete:focus, a.btn-delete:focus {
  color: #b91c1c !important;
  background: none !important;
  background-color: transparent !important;
}
.mfg-table-actions .btn-edit i, .mfg-table-actions .btn-delete i,
.btn-edit i, .btn-delete i, .btn-bom-edit i, .btn-bom-delete i,
a.btn-edit i, a.btn-delete i {
  font-size: 0.9rem;
}

/* Fixed column widths so separate tables align */
.mfg-table.mfg-table-fixed { table-layout: fixed; }
.mfg-table.mfg-table-fixed th:nth-child(1),
.mfg-table.mfg-table-fixed td:nth-child(1) { width: 18%; }
.mfg-table.mfg-table-fixed th:nth-child(2),
.mfg-table.mfg-table-fixed td:nth-child(2) { width: 34%; }
.mfg-table.mfg-table-fixed th:nth-child(3),
.mfg-table.mfg-table-fixed td:nth-child(3) { width: 12%; }
.mfg-table.mfg-table-fixed th:nth-child(4),
.mfg-table.mfg-table-fixed td:nth-child(4) { width: 10%; }
.mfg-table.mfg-table-fixed th:nth-child(5),
.mfg-table.mfg-table-fixed td:nth-child(5) { width: 12%; }
.mfg-table.mfg-table-fixed th:nth-child(6),
.mfg-table.mfg-table-fixed td:nth-child(6) { width: 22%; min-width: 200px; white-space: nowrap; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.alert { padding: 16px; border-radius: 8px; margin-bottom: 20px; }
.alert-warning { background: #fef3c7; border: 1px solid #f59e0b; }
.alert-success { background: #d1fae5; border: 1px solid #059669; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.form-row.align-end { align-items: end; }
.form-row.add-plan-form { align-items: start; }
.form-group-btn { display: flex; flex-direction: column; }
.form-group-btn .btn-dispatch { align-self: flex-start; white-space: nowrap; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.9rem; }
.form-group input, .form-group select { width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 6px; }
.form-static { margin: 0; padding: 8px 0; font-size: 1rem; color: #1e293b; }

/* Create Production Order – selected product(s) clearly displayed */
.production-order-products-summary {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-left: 4px solid #0094dc;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.production-order-products-summary strong { color: #0c4a6e; font-size: 0.95rem; }
.production-order-products-summary ul { margin: 10px 0 0 0; padding-left: 20px; }
.production-order-products-summary li { margin-bottom: 6px; color: #1e293b; }
.production-order-products-summary .product-code { font-weight: 700; color: #0094dc; }
.production-order-products-summary .product-qty { color: #64748b; font-weight: 500; margin-left: 8px; }
.production-order-lines .production-order-product-cell { background: #f8fafc; font-weight: 500; }
.production-order-lines .production-order-product-cell strong { color: #0094dc; }
.production-order-bom-cell { vertical-align: top; }
.production-order-bom-list { margin: 0; padding-left: 18px; font-size: 0.9rem; color: #374151; }
.production-order-bom-list li { margin-bottom: 4px; }
.production-order-bom-list li strong { color: #0094dc; }
.production-order-bom-cell .text-muted { font-style: italic; color: #9ca3af; }

/* Production Plan: Source + BOM column */
.plan-source-so { color: #0094dc; font-weight: 600; text-decoration: none; }
.plan-source-so:hover { text-decoration: underline; }
.plan-source-manual { color: #64748b; font-size: 0.9rem; }
.plan-bom-cell { vertical-align: top; font-size: 0.9rem; }
.plan-bom-list { margin: 0; padding-left: 18px; }
.plan-bom-list li { margin-bottom: 2px; }
.plan-bom-list li strong { color: #0094dc; }
.production-plan-table .text-muted { font-style: italic; color: #9ca3af; }
/* Machine(s) checkboxes – aligned and not clipped in scroll */
.machine-checkboxes {
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 10px 12px;
  padding-bottom: 12px;
  background: #fff;
}
.machine-checkboxes label {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0 0 8px 0;
  min-height: 24px;
  line-height: 1.4;
}
.machine-checkboxes label:last-child { margin-bottom: 0; }
.machine-checkboxes input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0 10px 0 0;
  width: 1rem;
  height: 1rem;
  vertical-align: middle;
}
.machine-checkboxes.machine-checkboxes--tall { max-height: 160px; }
.machine-checkboxes.machine-checkboxes--add-plan { max-height: 280px; }

.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-actions .btn-book-demo { margin: 0; padding: 10px 16px; min-height: 42px; box-sizing: border-box; }
/* Force button palette: #0092d9, #d7e021, white only (override Tabler/other) */
.mfg-container .btn-book-demo,
.dashboard-container .btn-book-demo,
.btn-book-demo {
  background: #0092d9 !important;
  color: #fff !important;
  border-color: #0092d9 !important;
}
.mfg-container .btn-book-demo:hover,
.dashboard-container .btn-book-demo:hover,
.btn-book-demo:hover {
  background: #007ab5 !important;
  color: #fff !important;
}
.btn-book-demo.btn-secondary { background: #d7e021 !important; color: #1e293b !important; border: none !important; }
.btn-book-demo.btn-secondary:hover { background: #c5cc1a !important; color: #1e293b !important; }

/* GRN line row: Item and Qty take space, Remove column is auto (small) */
#grn-lines .grn-line.form-row {
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
}
/* GRN line Remove button – compact (override .form-group input) */
#grn-lines .grn-remove-line,
.form-group .grn-remove-line {
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
  padding: 2px 6px !important;
  font-size: 0.75rem !important;
  min-height: auto !important;
  height: auto !important;
  line-height: 1.2 !important;
  box-sizing: content-box;
  background: #d7e021 !important;
  color: #1e293b !important;
}
#grn-lines .grn-remove-line:hover,
.form-group .grn-remove-line:hover { background: #c5cc1a !important; }

.mfg-dl { margin: 0 0 1rem 0; }
.mfg-dl dt { font-weight: 600; color: #374151; margin-top: 10px; }
.mfg-dl dt:first-child { margin-top: 0; }
.mfg-dl dd { margin: 4px 0 0 0; color: #6b7280; }

/* BOM Add / Material lines table form */
.mfg-form .mfg-table { margin-top: 0; margin-bottom: 0; }
.mfg-form .mfg-table th { background: #f8fafc; font-weight: 600; color: #374151; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; }
.mfg-form .mfg-table td { padding: 10px 16px; border-bottom: 1px solid #e5e7eb; vertical-align: middle; }
.mfg-form .mfg-table td select,
.mfg-form .mfg-table td input[type="text"],
.mfg-form .mfg-table td input[type="number"] {
  width: 100%;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
}
.mfg-form .mfg-table td select:focus,
.mfg-form .mfg-table td input:focus {
  outline: none;
  border-color: #1a5f7a;
  box-shadow: 0 0 0 2px rgba(26, 95, 122, 0.15);
}
.mfg-form .mfg-table td input[type="number"] { min-width: 0; }
.mfg-form .mfg-table .bom-qty { width: 100px; max-width: 120px; }
.mfg-form .mfg-table .bom-unit { width: 80px; max-width: 100px; }

.alerts-list { margin-top: 24px; }
.alert-item { padding: 12px 16px; background: #fff; border-left: 4px solid #f59e0b; margin-bottom: 8px; border-radius: 4px; }

/* Existing BOMs list */
.bom-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.bom-card { background: #fff; border-radius: 8px; border: 1px solid #e5e7eb; box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow: hidden; }
.bom-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; background: #f8fafc; border-bottom: 1px solid #e5e7eb; font-size: 1rem; }
.bom-card-head strong { color: #1e293b; }
.bom-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bom-meta { font-size: 0.8rem; color: #64748b; font-weight: 500; }
/* Collapsible BOM list: only BOMs shown until expanded */
.bom-list-collapsible .bom-card-collapsible .bom-card-head { border-bottom: 1px solid #e5e7eb; }
.bom-list-collapsible .bom-card-collapsible:not(.expanded) .bom-card-head { border-bottom: none; }
.bom-card-head-toggle { cursor: pointer; user-select: none; }
.bom-card-head-toggle:hover { background: #f1f5f9; }
.bom-card-head-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bom-toggle-icon { display: inline-block; width: 20px; text-align: center; color: #64748b; transition: transform 0.2s; }
.bom-card-collapsible.expanded .bom-toggle-icon { transform: rotate(90deg); }
.bom-meta-inline { font-size: 0.8rem; color: #64748b; font-weight: 500; }
.bom-line-count { font-size: 0.85rem; color: #94a3b8; font-weight: 400; }
.btn-bom-action { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 0.8rem; font-weight: 500; border-radius: 6px; text-decoration: none; transition: opacity 0.2s; }
.btn-bom-action:hover { opacity: 0.9; }
.bom-card-body { padding: 16px 18px; }
.bom-card-body .text-muted { margin: 0; font-size: 0.9rem; color: #94a3b8; }
.mfg-table-compact { margin: 0; }
.mfg-table-compact th, .mfg-table-compact td { padding: 8px 12px; font-size: 0.9rem; }
.mfg-table-compact th { background: #f8fafc; }

/* Force sidebar (nv-bar) to stay expanded on desktop - overrides Tabler */
@media (min-width: 768px) {
  .page aside.navbar-vertical,
  .page .navbar-vertical.navbar-expand-lg {
    width: 16rem !important;
    min-width: 16rem !important;
    max-width: 16rem !important;
    flex: 0 0 16rem !important;
  }
  .page #sidebar-menu,
  .page .navbar-vertical .navbar-collapse {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
  }
  .page .navbar-vertical .navbar-toggler {
    display: none !important;
  }
}
