/* Shared ERP UI primitives.
   This layer is intentionally generic and can be used by Master, Accounts,
   Asset, Inventory, Warehouse, Purchase, Sales, and Accounting pages. */

:root {
  --erp-ink: #172033;
  --erp-muted: #667085;
  --erp-line: #dbe4f0;
  --erp-line-strong: #b9c7d8;
  --erp-surface: #f6f8fb;
  --erp-panel: #ffffff;
  --erp-accent: #0f766e;
  --erp-accent-strong: #0b5f59;
  --erp-accent-soft: #ccfbf1;
  --erp-info: #0369a1;
  --erp-info-soft: #e0f2fe;
  --erp-success: #047857;
  --erp-success-soft: #d1fae5;
  --erp-warning: #92400e;
  --erp-warning-soft: #fef3c7;
  --erp-danger: #991b1b;
  --erp-danger-soft: #fee2e2;
  --erp-neutral-soft: #eef2f7;
  --erp-shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
  --erp-radius-lg: 24px;
  --erp-radius-md: 16px;
  --erp-radius-sm: 12px;
}

.erp-page {
  max-width: 1600px;
  margin: 0 auto;
  color: var(--erp-ink);
}

#main > .pagetitle,
#main > .d-flex.justify-content-between,
#main > .d-flex.justify-content-between.align-items-start,
#main > .d-flex.justify-content-between.flex-column,
#main > .d-flex.justify-content-between.flex-md-row,
#main > .d-flex.justify-content-between.align-items-start.gap-3,
#main > .mb-3:first-child,
.erp-legacy-page > .pagetitle,
.erp-legacy-page > .d-flex.justify-content-between.align-items-start,
.erp-legacy-page > .d-flex.justify-content-between,
.erp-legacy-page > .d-flex.justify-content-between.flex-column,
.erp-legacy-page > .d-flex.justify-content-between.flex-md-row,
.erp-legacy-page > .d-flex.justify-content-between.align-items-start.gap-3,
.erp-legacy-page > .mb-3:first-child {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-lg);
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.13), transparent 35%),
    linear-gradient(135deg, #ffffff 0%, #f3fbf8 100%);
  box-shadow: var(--erp-shadow);
}

#main > .pagetitle h1,
#main > .d-flex.justify-content-between h1,
#main > .d-flex.justify-content-between h4,
#main > .d-flex.justify-content-between.flex-column h1,
#main > .d-flex.justify-content-between.flex-md-row h1,
#main > .d-flex.justify-content-between.align-items-start.gap-3 h4,
#main > .mb-3:first-child h4,
.erp-legacy-page > .pagetitle h1,
.erp-legacy-page > .d-flex.justify-content-between h1,
.erp-legacy-page > .d-flex.justify-content-between h4,
.erp-legacy-page > .d-flex.justify-content-between.align-items-start h4,
.erp-legacy-page > .d-flex.justify-content-between.flex-column h1,
.erp-legacy-page > .d-flex.justify-content-between.flex-md-row h1,
.erp-legacy-page > .d-flex.justify-content-between.align-items-start.gap-3 h4,
.erp-legacy-page > .mb-3:first-child h4 {
  margin: 0;
  color: var(--erp-ink);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

#main > nav .breadcrumb,
#main > .pagetitle .breadcrumb,
#main > .d-flex.justify-content-between nav,
#main > .mb-3:first-child .text-muted,
.erp-legacy-page > .pagetitle .breadcrumb,
.erp-legacy-page > .d-flex.justify-content-between.align-items-start nav,
.erp-legacy-page > .d-flex.justify-content-between nav,
.erp-legacy-page > nav .breadcrumb,
.erp-legacy-page > .mb-3:first-child .text-muted {
  margin: 8px 0 0;
  color: var(--erp-muted);
  font-size: 13px;
}

#main > nav {
  max-width: 1600px;
  margin: 0 auto 22px;
}

#main > nav .breadcrumb {
  padding: 0 4px;
  background: transparent;
}

#main > .erp-page-header,
#main > .pagetitle,
#main > section.section,
#main > .section,
#main > .row,
#main > .card {
  max-width: 1600px;
  margin-right: auto;
  margin-left: auto;
}

#main > section.section,
#main > .section {
  color: var(--erp-ink);
}

#main .card,
.erp-legacy-page .card {
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-md);
  background: var(--erp-panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

#main .card-body,
.erp-legacy-page .card-body {
  padding: 22px;
}

#main .card-title,
.erp-legacy-page .card-title {
  margin: 0 0 12px;
  color: var(--erp-ink);
  font-size: 16px;
  font-weight: 800;
}

#main .card-title::after,
.erp-legacy-page .card-title::after {
  display: block;
  width: 100%;
  height: 1px;
  margin-top: 12px;
  background: var(--erp-line);
  content: "";
}

#main > .d-flex.justify-content-between .pagetitle,
#main > .d-flex.justify-content-between .pagetitle h1 {
  margin-bottom: 0;
}

#main > .d-flex.justify-content-between.mb-sm-0,
#main > .d-flex.justify-content-between.mb-2 {
  margin-bottom: 16px !important;
}

#main > .d-flex.justify-content-between .btn {
  min-height: 40px;
}

#main > section.section > .row {
  margin-bottom: 22px;
}

#main > section.section > .row:last-child {
  margin-bottom: 0;
}

#main > section.section > .row > [class*="col-"] > .card:has(table.datatable),
#main > section.section > .row > [class*="col-"] > .card:has(table.erp-table) {
  border-radius: var(--erp-radius-md);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

#main > section.section > .row > [class*="col-"] > .card:has(table.datatable) .card-title,
#main > section.section > .row > [class*="col-"] > .card:has(table.erp-table) .card-title {
  font-size: 16px;
}

#main > section.section > .row > [class*="col-"] > .card:has(form) .card-title {
  margin-bottom: 14px;
}

#main > section.section > .row.mt-4:last-child {
  max-width: 1600px;
  margin: 22px auto 0;
}

#main > section.section > .row.mt-4:last-child .text-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

#main > section.section > .row.mt-4:last-child .btn,
#main > section.section > .row.mt-4:last-child input[type="button"].btn {
  margin-top: 0 !important;
}

#main .control-label,
#main .form-label,
#main .label,
#main .detail-label,
#main .org-detail-label,
.erp-legacy-page .control-label,
.erp-legacy-page .form-label,
.erp-legacy-page .label,
.erp-legacy-page .detail-label,
.erp-legacy-page .org-detail-label {
  color: var(--erp-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#main .form-control,
#main .form-select,
#main .select2-container .select2-selection--single,
#main .select2-container .select2-selection--multiple,
.erp-legacy-page .form-control,
.erp-legacy-page .form-select,
.erp-legacy-page .select2-container .select2-selection--single,
.erp-legacy-page .select2-container .select2-selection--multiple {
  min-height: 42px;
  border-color: var(--erp-line);
  border-radius: var(--erp-radius-sm);
}

#main .form-control::file-selector-button,
#main .form-control::-webkit-file-upload-button,
.erp-legacy-page .form-control::file-selector-button,
.erp-legacy-page .form-control::-webkit-file-upload-button,
.erp-form-grid .form-control::file-selector-button,
.erp-form-grid .form-control::-webkit-file-upload-button {
  height: 40px;
}

#main .input-group > .form-control:not(:last-child),
#main .input-group > .form-select:not(:last-child),
#main .input-group > .input-group-text:not(:last-child),
.erp-legacy-page .input-group > .form-control:not(:last-child),
.erp-legacy-page .input-group > .form-select:not(:last-child),
.erp-legacy-page .input-group > .input-group-text:not(:last-child) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

#main .input-group > :not(:first-child):not(.dropdown-menu),
.erp-legacy-page .input-group > :not(:first-child):not(.dropdown-menu) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  margin-left: -1px;
}

#main .input-group-text,
.erp-legacy-page .input-group-text {
  min-height: 42px;
  border-color: var(--erp-line);
  border-radius: var(--erp-radius-sm);
}

#main .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 40px !important;
}

#main .select2-container .select2-selection--single .select2-selection__arrow {
  height: 40px !important;
}

#main .select2-container.select2-container--disabled .select2-selection--single,
#main .select2-container.select2-container--disabled .select2-selection--multiple,
.select2-container--disabled .select2-selection {
  background-color: #e9ecef !important;
  border-color: var(--erp-line, #dbe4f0) !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  opacity: 0.85 !important;
}

#main .select2-container.select2-container--disabled .select2-selection__clear,
.select2-container--disabled .select2-selection__clear {
  display: none !important;
}

#main .select2-container.select2-container--disabled .select2-selection__arrow,
.select2-container--disabled .select2-selection__arrow {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

#main .form-text {
  color: var(--erp-muted);
  font-size: 12px;
  line-height: 1.45;
}

#main .errorlist,
.erp-legacy-page .errorlist {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--erp-danger);
  font-size: 13px;
}

#main .detail-row,
#main .org-detail-row,
.erp-legacy-page .detail-row,
.erp-legacy-page .org-detail-row {
  border-bottom-color: var(--erp-line);
}

#main .table-responsive {
  border-radius: var(--erp-radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#main table.table:not(.calendar-table) {
  margin-bottom: 0;
}

#main table.table thead th,
#main table.table tfoot th {
  border-bottom: 1px solid var(--erp-line-strong);
  background: #f8fbff;
  color: var(--erp-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

#main table.table tbody td,
#main table.table tbody th {
  color: var(--erp-ink);
  vertical-align: middle;
}

#main table.table td,
#main table.table th {
  max-width: 360px;
  overflow-wrap: anywhere;
}

#main .datatable {
  width: 100% !important;
}

#main .dt-container,
#main .dataTables_wrapper {
  color: var(--erp-ink);
}

#main .dt-container div.dt-layout-table > div,
#main .dt-container .dt-scroll-body {
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

#main .dt-scroll-head table,
#main .dt-container div.dt-scroll-head table {
  visibility: visible !important;
}

#main .dt-container .dt-layout-row,
#main .dataTables_wrapper .row {
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

#main .dt-search input,
#main .dataTables_filter input,
#main .dt-length select,
#main .dataTables_length select {
  min-height: 42px;
  border-color: var(--erp-line);
  border-radius: var(--erp-radius-sm);
}

#main .dropdown-menu {
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-sm);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

#main .dropdown-item {
  color: var(--erp-ink);
  font-size: 13px;
}

#main .btn {
  border-radius: 12px;
  font-weight: 700;
}

.erp-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-lg);
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.13), transparent 35%),
    linear-gradient(135deg, #ffffff 0%, #f3fbf8 100%);
  box-shadow: var(--erp-shadow);
}

.erp-page-eyebrow {
  margin: 0 0 8px;
  color: var(--erp-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.erp-page-title {
  margin: 0;
  color: var(--erp-ink);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.erp-page-subtitle {
  max-width: 920px;
  margin: 8px 0 0;
  color: var(--erp-muted);
  font-size: 14px;
  line-height: 1.55;
}

.erp-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.erp-section {
  margin-bottom: 28px;
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-lg);
  padding: 22px;
  background: var(--erp-surface);
}

.erp-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.erp-section-title {
  margin: 0;
  color: var(--erp-ink);
  font-size: 18px;
  font-weight: 800;
}

.erp-section-subtitle {
  margin: 6px 0 0;
  color: var(--erp-muted);
  font-size: 13px;
  line-height: 1.45;
}

.erp-card,
.erp-kpi-card,
.erp-action-card,
.erp-filter-panel,
.erp-table-card,
.erp-empty-state {
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-md);
  background: var(--erp-panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.erp-card,
.erp-kpi-card,
.erp-filter-panel,
.erp-table-card,
.erp-empty-state {
  padding: 22px;
}

.erp-card-title {
  margin: 0 0 12px;
  color: var(--erp-ink);
  font-size: 16px;
  font-weight: 800;
}

.erp-card-text {
  margin: 0;
  color: var(--erp-muted);
  font-size: 13px;
  line-height: 1.5;
}

.erp-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.erp-detail-item {
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-md);
  padding: 0.875rem 1rem;
  background: var(--erp-surface);
}

.erp-detail-item span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--erp-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.erp-detail-item strong {
  display: block;
  min-height: 1.35rem;
  color: var(--erp-ink);
  font-size: 0.96rem;
  font-weight: 750;
}

.erp-muted-panel {
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-md);
  padding: 1rem;
  background: var(--erp-surface);
  color: var(--erp-ink);
  line-height: 1.65;
}

.erp-settings-page .erp-settings-card {
  margin-bottom: 22px;
}

.erp-settings-card-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--erp-line);
}

.erp-settings-card-header h5,
.erp-settings-card-header h2 {
  margin: 0;
  color: var(--erp-ink);
  font-size: 18px;
  font-weight: 800;
}

.erp-settings-card-header p {
  margin: 6px 0 0;
  color: var(--erp-muted);
  font-size: 13px;
  line-height: 1.45;
}

.erp-settings-card-body .form-label,
.erp-settings-subpanel .form-label {
  color: var(--erp-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.erp-settings-subpanel {
  border: 1px solid var(--erp-line);
  border-radius: var(--erp-radius-md);
  padding: 18px;
  background: var(--erp-surface);
}

.erp-settings-subpanel + .erp-settings-subpanel {
  margin-top: 16px;
}

.erp-settings-subtitle {
  margin: 0 0 14px;
  color: var(--erp-accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.erp-settings-page .errorlist {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--erp-danger);
  font-size: 13px;
}

.erp-settings-page .select2-container .select2-selection--single,
.erp-settings-page .select2-container .select2-selection--multiple {
  min-height: 42px;
  border-color: var(--erp-line);
  border-radius: var(--erp-radius-sm);
}

.erp-settings-page .select2-container:not(.select2-summary-multiple) .select2-selection__rendered {
  line-height: 40px !important;
}

.erp-settings-page .select2-selection__arrow {
  min-height: 40px;
}

.erp-settings-page .select2-summary-multiple {
  position: relative;
}

.erp-settings-page .select2-summary-multiple .select2-selection--multiple {
  display: flex;
  position: relative;
  height: 42px !important;
  min-height: 42px !important;
  align-items: center;
  padding: 0 42px 0 12px !important;
  overflow: hidden;
}

.erp-settings-page .select2-summary-multiple .select2-selection__rendered::after {
  content: none !important;
  display: none !important;
}

.erp-settings-page .select2-summary-multiple .select2-selection__rendered {
  display: none !important;
}

.erp-settings-page .select2-summary-multiple .select2-selection--multiple::before {
  content: none !important;
  display: none !important;
}

.erp-settings-page .select2-summary-multiple .erp-select2-summary-overlay {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 42px;
  left: 12px;
  transform: translateY(-50%);
  display: block !important;
  color: var(--erp-ink);
  line-height: 1.35;
  overflow: hidden;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-settings-page .select2-summary-multiple.select2-container--open .erp-select2-summary-overlay {
  display: block !important;
}

.erp-settings-page .select2-summary-multiple.select2-container--open .select2-selection__rendered {
  display: none !important;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  margin: 0;
  padding: 0 !important;
  line-height: 1.35 !important;
  overflow: hidden;
}

.erp-settings-page .select2-summary-multiple .select2-selection__choice,
.erp-settings-page .select2-summary-multiple .select2-search,
.erp-settings-page .select2-summary-multiple .select2-search__field,
.erp-settings-page .select2-summary-multiple .select2-selection__placeholder {
  display: none !important;
}

.erp-settings-page .select2-summary-multiple.select2-container--open .select2-selection__choice {
  display: none !important;
}

.erp-settings-page .select2-summary-multiple.select2-container--open .select2-search {
  display: none !important;
  width: 100%;
}

.erp-settings-page .select2-summary-multiple.select2-container--open .select2-search__field {
  display: none !important;
  width: 100% !important;
  min-height: 24px;
  margin: 0;
}

.erp-kpi-grid,
.erp-action-grid,
.erp-filter-grid {
  display: grid;
  gap: 18px;
}

.erp-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.erp-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.erp-filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.erp-kpi-label {
  margin-bottom: 8px;
  color: var(--erp-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.erp-kpi-value {
  margin: 0;
  color: var(--erp-ink);
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
}

.erp-kpi-help {
  margin: 8px 0 0;
  color: var(--erp-muted);
  font-size: 12px;
}

.erp-action-card {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.erp-action-card:hover,
.erp-action-card:focus-visible {
  color: inherit;
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.erp-action-card-title {
  margin: 0;
  color: var(--erp-ink);
  font-size: 16px;
  font-weight: 800;
}

.erp-action-card-text {
  margin: 0;
  color: var(--erp-muted);
  font-size: 13px;
  line-height: 1.45;
}

.erp-filter-panel {
  margin-bottom: 22px;
}

.erp-filter-panel label,
.erp-filter-panel .form-label {
  color: var(--erp-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.erp-filter-panel .form-control,
.erp-filter-panel .form-select,
.erp-form-grid .form-control,
.erp-form-grid .form-select {
  min-height: 42px;
  border-color: var(--erp-line);
  border-radius: var(--erp-radius-sm);
}

.erp-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.erp-form-actions,
.erp-action-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.erp-table-card {
  overflow: hidden;
}

.erp-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.erp-table-title {
  margin: 0;
  color: var(--erp-ink);
  font-size: 16px;
  font-weight: 800;
}

.erp-table {
  margin-bottom: 0;
}

#main table.erp-table:not(.nowrap) td,
#main table.erp-table:not(.nowrap) th {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#main table.erp-table.nowrap td:not(.erp-cell-wrap),
#main table.erp-table.nowrap th:not(.erp-cell-wrap),
#main table.dataTable.nowrap td:not(.erp-cell-wrap),
#main table.dataTable.nowrap th:not(.erp-cell-wrap) {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

#main table.erp-table td.erp-cell-wrap,
#main table.erp-table th.erp-cell-wrap,
#main table.dataTable td.erp-cell-wrap,
#main table.dataTable th.erp-cell-wrap {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: normal;
}

#main table.erp-table thead th,
#main table.erp-table tfoot th,
#main table.erp-table th.text-nowrap,
#main table.erp-table td.text-nowrap,
#main table.erp-table .text-nowrap,
#main table.erp-table .erp-cell-nowrap,
#main table.erp-table .erp-status-badge,
#main table.erp-table .dropdown,
#main table.erp-table .btn,
#main table.erp-table:not(.nowrap) thead th,
#main table.erp-table:not(.nowrap) tfoot th,
#main table.erp-table:not(.nowrap) th.text-nowrap,
#main table.erp-table:not(.nowrap) td.text-nowrap,
#main table.erp-table:not(.nowrap) .text-nowrap,
#main table.erp-table:not(.nowrap) .erp-cell-nowrap,
#main table.erp-table:not(.nowrap) .erp-status-badge,
#main table.erp-table:not(.nowrap) .dropdown,
#main table.erp-table:not(.nowrap) .btn {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

.erp-cell-truncate {
  display: block !important;
  max-width: var(--erp-cell-max, 26rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

.erp-cell-clamp {
  display: -webkit-box !important;
  max-width: var(--erp-cell-max, 28rem);
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: var(--erp-cell-lines, 2);
}

.erp-badge-truncate {
  display: inline-block !important;
  max-width: var(--erp-badge-max, 14rem);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap !important;
}

.erp-table thead th,
.erp-table tfoot th {
  border-bottom: 1px solid var(--erp-line-strong);
  background: #f8fbff;
  color: var(--erp-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.erp-table td,
.erp-table th {
  vertical-align: middle;
}

.erp-report-page .erp-page-header {
  margin-bottom: 12px;
}

.erp-report-breadcrumb {
  margin: 0 0 22px;
  padding: 0 6px;
}

.erp-report-breadcrumb .breadcrumb {
  margin-bottom: 0;
  background: transparent;
  color: var(--erp-muted);
  font-size: 0.9rem;
}

.erp-report-breadcrumb .breadcrumb-item,
.erp-report-breadcrumb .breadcrumb-item a {
  color: var(--erp-muted);
  font-weight: 600;
  text-decoration: none;
}

.erp-report-breadcrumb .breadcrumb-item.active {
  color: var(--erp-ink);
  font-weight: 750;
}

.erp-report-filter-card .erp-section-header {
  margin-bottom: 16px;
}

.erp-report-filter-actions {
  align-self: end;
}

.erp-report-page .erp-filter-grid > .erp-report-filter-actions,
.erp-report-page .erp-filter-grid > .inventory-report-filter-actions {
  grid-column: 1 / -1;
  justify-self: end;
  width: min(360px, 100%);
}

.erp-report-page .erp-filter-grid > .erp-report-filter-actions .d-flex,
.erp-report-page .erp-filter-grid > .inventory-report-filter-actions .d-flex {
  justify-content: flex-end;
}

.erp-report-filter-actions .btn {
  min-height: 42px;
}

.finance-aging-filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.finance-aging-check {
  align-self: end;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.erp-report-page .erp-filter-grid > .erp-report-filter-actions .btn,
.erp-report-page .erp-filter-grid > .inventory-report-filter-actions .btn {
  flex: 0 0 auto !important;
  min-width: 132px;
  white-space: nowrap;
}

.erp-report-table-card {
  margin-top: 22px;
}

.erp-report-table {
  min-width: 860px;
}

.erp-report-table th {
  white-space: nowrap;
}

.erp-report-table .erp-report-text {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.erp-report-table .erp-report-number {
  color: var(--erp-ink);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.ops-list-table {
  min-width: 860px;
}

.ops-list-table th,
.ops-list-table td {
  white-space: normal;
}

.ops-list-table .ops-check-col {
  width: 42px;
}

.ops-list-table .ops-action-col {
  width: 150px;
}

.ops-list-table .ops-id-col {
  min-width: 150px;
  white-space: nowrap;
}

.ops-list-table .ops-main {
  color: var(--erp-ink);
  font-weight: 800;
  line-height: 1.25;
}

.ops-list-table .ops-sub {
  color: var(--erp-muted);
  font-size: 12px;
  line-height: 1.35;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-list-table .ops-stack {
  display: grid;
  gap: 3px;
}

.ops-list-table .ops-counts {
  color: var(--erp-ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.ops-list-table .ops-date {
  color: var(--erp-ink);
  font-weight: 700;
  white-space: nowrap;
}

.erp-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.erp-status-badge.neutral,
.erp-status-badge.draft,
.erp-status-badge.pending,
.erp-status-badge.secondary {
  background: var(--erp-neutral-soft);
  color: #475467;
}

.erp-status-badge.info,
.erp-status-badge.review,
.erp-status-badge.sent {
  background: var(--erp-info-soft);
  color: var(--erp-info);
}

.erp-status-badge.success,
.erp-status-badge.approved,
.erp-status-badge.posted,
.erp-status-badge.fulfilled,
.erp-status-badge.paid,
.erp-status-badge.completed {
  background: var(--erp-success-soft);
  color: var(--erp-success);
}

.erp-status-badge.warning,
.erp-status-badge.hold,
.erp-status-badge.partial,
.erp-status-badge.rejected {
  background: var(--erp-warning-soft);
  color: var(--erp-warning);
}

.erp-status-badge.danger,
.erp-status-badge.cancelled,
.erp-status-badge.void,
.erp-status-badge.failed,
.erp-status-badge.overdue {
  background: var(--erp-danger-soft);
  color: var(--erp-danger);
}

/* Subtle badge utilities for Bootstrap 5.2 compatibility */
.bg-info-subtle,
.badge.bg-info-subtle {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #bae6fd !important;
}

.text-info-emphasis {
  color: #0369a1 !important;
}

.bg-success-subtle,
.badge.bg-success-subtle {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  border-color: #bbf7d0 !important;
}

.text-success-emphasis {
  color: #15803d !important;
}

.bg-warning-subtle,
.badge.bg-warning-subtle {
  background-color: #fef9c3 !important;
  color: #a16207 !important;
  border-color: #fde047 !important;
}

.text-warning-emphasis {
  color: #a16207 !important;
}

.bg-danger-subtle,
.badge.bg-danger-subtle {
  background-color: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fecaca !important;
}

.text-danger-emphasis {
  color: #b91c1c !important;
}

.bg-primary-subtle,
.badge.bg-primary-subtle {
  background-color: #e0e7ff !important;
  color: #4338ca !important;
  border-color: #c7d2fe !important;
}

.text-primary-emphasis {
  color: #4338ca !important;
}

.bg-secondary-subtle,
.badge.bg-secondary-subtle {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}

.text-secondary-emphasis {
  color: #475569 !important;
}

.erp-empty-state {
  text-align: center;
}

.erp-empty-state-icon {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--erp-accent-soft);
  color: var(--erp-accent);
  font-size: 24px;
}

.erp-empty-state-title {
  margin: 0;
  color: var(--erp-ink);
  font-size: 16px;
  font-weight: 800;
}

.erp-empty-state-text {
  max-width: 560px;
  margin: 8px auto 0;
  color: var(--erp-muted);
  font-size: 13px;
  line-height: 1.5;
}

.erp-modal-header {
  border-bottom: 1px solid var(--erp-line);
  background: #f8fbff;
}

.erp-modal-title {
  color: var(--erp-ink);
  font-weight: 800;
}

.modal-header .btn-close,
.erp-modal-header .btn-close {
  font-size: 1.5rem;
  padding: 0.5rem;
  opacity: 0.75;
  transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.modal-header .btn-close:hover,
.erp-modal-header .btn-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

.erp-filter-field-wrap,
.filter-field-wrap {
  position: relative;
}

.erp-filter-clear-btn,
.filter-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  z-index: 5;
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #6c757d;
  font-size: 13px;
  line-height: 1;
  transform: translateY(-50%);
}

.erp-filter-clear-btn:hover,
.filter-clear-btn:hover {
  color: #dc3545;
}

.erp-filter-field-wrap .form-control,
.filter-field-wrap .form-control {
  padding-right: 30px;
}

.erp-filter-field-wrap .select2-container .select2-selection--single,
.erp-filter-field-wrap .select2-container .select2-selection--multiple,
.filter-field-wrap .select2-container .select2-selection--single,
.filter-field-wrap .select2-container .select2-selection--multiple {
  padding-right: 34px !important;
}

.erp-filter-field-wrap .select2-summary-multiple .select2-selection--multiple,
.filter-field-wrap .select2-summary-multiple .select2-selection--multiple {
  display: flex !important;
  height: 42px !important;
  min-height: 42px !important;
  align-items: center !important;
  overflow: hidden !important;
}

.erp-filter-field-wrap .select2-summary-multiple .select2-selection__choice,
.erp-filter-field-wrap .select2-summary-multiple .select2-search--inline,
.erp-filter-field-wrap .select2-summary-multiple .select2-search__field,
.filter-field-wrap .select2-summary-multiple .select2-selection__choice,
.filter-field-wrap .select2-summary-multiple .select2-search--inline,
.filter-field-wrap .select2-summary-multiple .select2-search__field {
  display: none !important;
}

.erp-filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-selection__choice,
.erp-filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-search--inline,
.erp-filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-search__field,
.filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-selection__choice,
.filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-search--inline,
.filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-search__field {
  display: none !important;
}

.erp-filter-field-wrap .select2-summary-multiple .select2-selection__rendered,
.filter-field-wrap .select2-summary-multiple .select2-selection__rendered {
  display: block !important;
  width: 100% !important;
  min-height: 40px !important;
  line-height: 40px !important;
  padding: 0 42px 0 12px !important;
  overflow: hidden !important;
}

.erp-filter-field-wrap .select2-summary-multiple .select2-selection__rendered::before,
.filter-field-wrap .select2-summary-multiple .select2-selection__rendered::before {
  content: attr(data-summary) !important;
  display: block !important;
  color: #2b4c85;
  font-weight: 500;
  line-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-filter-field-wrap .select2-summary-multiple.select2-container--open .select2-selection__rendered::before,
.filter-field-wrap .select2-summary-multiple.select2-container--open .select2-selection__rendered::before {
  display: block !important;
}

.erp-filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-selection__rendered::before,
.filter-field-wrap .select2-container.select2-summary-multiple.select2-container--open .select2-selection--multiple .select2-selection__rendered::before {
  display: block !important;
}

.select2-results__option {
  background-color: #fff !important;
  color: #212529 !important;
}

.select2-results__option--highlighted {
  background-color: #fff !important;
  color: #212529 !important;
}

.select2-results__option[aria-selected="true"],
.select2-results__option--selected {
  background-color: #0d6efd !important;
  color: #fff !important;
}

.select2-results__option[aria-selected="true"].select2-results__option--highlighted,
.select2-results__option--selected.select2-results__option--highlighted {
  background-color: #0d6efd !important;
  color: #fff !important;
}

.asset-selection-footer {
  position: sticky;
  bottom: 12px;
  z-index: 50;
  padding: 10px 12px;
  border: 1px solid #dfe6f4;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 35, 70, 0.08);
}

#assetSelectionPreviewModal .modal-body {
  max-height: 65vh;
  overflow-y: auto;
}

.erp-legacy-ticket-note {
  width: min(400px, 100%);
  min-height: 40px;
  height: auto;
  resize: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.erp-focus-ring:focus-visible,
.erp-page .btn:focus-visible,
.erp-page a:focus-visible,
.erp-page input:focus-visible,
.erp-page select:focus-visible,
.erp-page textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

@media (max-width: 1199px) {
  .erp-kpi-grid,
  .erp-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-aging-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .erp-page-header,
  .erp-section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .erp-page-header,
  .erp-section,
  .erp-card,
  .erp-kpi-card,
  .erp-filter-panel,
  .erp-table-card,
  .erp-empty-state {
    padding: 18px;
  }

  .erp-page-title {
    font-size: 23px;
  }

  .erp-kpi-grid,
  .erp-action-grid,
  .erp-filter-grid,
  .finance-aging-filter-grid,
  .erp-form-grid {
    grid-template-columns: 1fr;
  }

  .erp-action-bar,
  .erp-action-footer,
  .erp-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .erp-action-bar .btn,
  .erp-action-footer .btn,
  .erp-form-actions .btn {
    width: 100%;
  }
}
/* Two-line item selectors used by RFQ and direct PO entry. */
.erp-item-choice {
    display: block;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

.erp-item-choice__name,
.erp-item-choice__code {
    display: block;
}

.erp-item-choice__name {
    font-weight: 600;
}

.erp-item-choice__code {
    margin-top: 3px;
    font-size: 0.85em;
    opacity: 0.8;
}

select[data-rfq-item-search] + .select2-container .select2-selection--single,
select[data-po-item-search] + .select2-container .select2-selection--single {
    height: auto;
    min-height: 54px;
}

#main select[data-rfq-item-search] + .select2-container .select2-selection--single .select2-selection__rendered,
#main select[data-po-item-search] + .select2-container .select2-selection--single .select2-selection__rendered {
    padding-top: 7px;
    padding-bottom: 7px;
    line-height: 1.25 !important;
    white-space: normal;
}

#main select[data-rfq-item-search] + .select2-container .select2-selection--single .select2-selection__arrow,
#main select[data-po-item-search] + .select2-container .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
}

.rfq-item-select2-dropdown {
    min-width: min(580px, calc(100vw - 32px)) !important;
    max-width: min(780px, calc(100vw - 32px)) !important;
    width: auto !important;
    box-sizing: border-box !important;
}

.rfq-item-select2-dropdown .select2-results__option {
    padding: 8px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    .rfq-item-select2-dropdown {
        min-width: min(380px, calc(100vw - 32px)) !important;
        max-width: calc(100vw - 32px) !important;
    }
}

@media (max-width: 575.98px) {
    .rfq-item-select2-dropdown {
        min-width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        width: calc(100vw - 24px) !important;
    }
}

