/* Shared ERP detail-page shell.
 *
 * Business templates provide only their record data and use these structural
 * classes. The visual language stays centralized alongside the list and form
 * workbenches.
 */
.mes-erp-detail {
  --mes-detail-blue: #087db9;
  --mes-detail-blue-dark: #126987;
  --mes-detail-border: #d6d6d6;
  --mes-detail-muted: #746c67;
  --mes-detail-text: #34383c;
  background: #fff;
  color: var(--mes-detail-text);
  font-family: Arial, "Segoe UI", sans-serif;
  min-height: calc(100vh - var(--mes-nav-height));
}

body.mes-erp-detail-page main > .container-fluid {
  max-width: none;
  padding: 0 !important;
}

.mes-erp-detail__header {
  align-items: center;
  border-bottom: 1px solid var(--mes-detail-border);
  display: flex;
  min-height: 52px;
  padding: 8px 18px;
}

.mes-erp-detail__breadcrumb {
  align-items: center;
  color: var(--mes-detail-blue);
  display: flex;
  flex-wrap: wrap;
  font-size: 20px;
  gap: 7px;
  margin: 0;
}

.mes-erp-detail__breadcrumb i {
  color: #777;
  font-size: 18px;
}

.mes-erp-detail__breadcrumb a {
  color: var(--mes-detail-blue);
  text-decoration: none;
}

.mes-erp-detail__breadcrumb-current {
  color: var(--mes-detail-blue);
}

.mes-erp-detail__toolbar {
  /* align-items: center; */
  background: #fff;
  border-bottom: 1px solid var(--mes-detail-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  min-height: 48px;
  padding: 5px 9px;
}

.mes-production-control-panel {
  border-bottom: 1px solid var(--mes-detail-border);
}

.mes-production-control-panel .o_control_panel_main {
  min-height: 46px;
}

.mes-production-control-panel__actions {
  min-width: 0;
}

.mes-production-control-panel__actions form {
  margin: 0;
}

.mes-production-control-panel__dropdown .dropdown-toggle::after {
  margin-left: 0.45rem;
}

.mes-production-control-panel__menu {
  border: 1px solid #d7dce0;
  border-radius: 0.25rem;
  box-shadow: 0 6px 18px rgb(0 0 0 / 12%);
  min-width: 14rem;
  padding: 0.35rem 0;
}

.mes-production-control-panel__menu .dropdown-item {
  align-items: center;
  color: #34383c;
  display: flex;
  font-size: 0.95rem;
  gap: 0.15rem;
  line-height: 1.35;
  padding: 0.42rem 0.95rem;
}

.mes-production-control-panel__menu .dropdown-item i {
  color: #8a90a0;
  width: 1.15rem;
}

.mes-production-control-panel__menu .dropdown-item:hover,
.mes-production-control-panel__menu .dropdown-item:focus {
  background: #f2f2f2;
  color: #111;
}

.mes-production-control-panel__menu .dropdown-item.text-danger i {
  color: #dc3545;
}

.mes-production-control-panel__menu .dropdown-divider {
  margin: 0.35rem 0;
}

.mes-production-control-panel__smart-buttons {
  flex: 0 0 auto;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.mes-erp-detail__toolbar .btn {
  align-items: center;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--mes-detail-text) !important;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  text-decoration: none;
}

.mes-erp-detail__toolbar .btn:hover,
.mes-erp-detail__toolbar .btn:focus {
  background: #eef3f6 !important;
  color: var(--mes-detail-blue) !important;
  text-decoration: none;
}

.mes-erp-detail__toolbar .btn:focus-visible {
  outline: 2px solid rgba(8, 125, 185, 0.45);
  outline-offset: -2px;
}

.mes-erp-detail__toolbar .btn i {
  color: #98a3ab;
  font-size: 16px;
  margin-right: 7px !important;
  text-align: center;
  width: 17px;
}

.mes-erp-detail__toolbar .btn:hover i,
.mes-erp-detail__toolbar .btn:focus i {
  color: var(--mes-detail-blue);
}

.mes-erp-detail__hero {
  align-items: start;
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 375px);
  min-height: 185px; 
  padding: 5px 20px 28px;
}

.mes-erp-detail__identity {
  align-items: flex-start;
  display: flex;
  gap: 26px;
  min-width: 0;
}

.mes-erp-detail__avatar {
  align-items: center;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgb(0 0 0 / 16%);
  color: #c8c8c8;
  display: flex;
  flex: 0 0 82px;
  font-size: 42px;
  height: 82px;
  justify-content: center;
  overflow: hidden;
}

.mes-erp-detail__avatar img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.mes-erp-detail__eyebrow {
  color: #3f4549;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 5px;
}

.mes-erp-detail__title {
  color: #34383c;
  font-size: clamp(1.65rem, 2.3vw, 2.15rem);
  font-weight: 700;
  line-height: 1.12;
  margin: 0;
  max-width: 780px;
  overflow-wrap: anywhere;
}

.mes-erp-detail__subtitle {
  color: var(--mes-detail-muted);
  font-size: 15px;
  margin: 10px 0 0;
}

.mes-erp-detail__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.mes-erp-detail__badge {
  align-items: center;
  color: #3f4549;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
}

.mes-erp-detail__badge i {
  color: var(--mes-detail-blue);
}

.mes-erp-detail__stats {
  align-items: stretch;
  border: 1px solid var(--mes-detail-border);
  border-radius: 4px;
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
}

.mes-erp-detail__stat {
  align-items: center;
  background: #fff;
  border: 0 !important;
  border-right: 1px solid var(--mes-detail-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: #615955;
  display: grid;
  gap: 10px;
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 40px;
  min-width: 130px;
  padding: 7px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.mes-erp-detail__stat:last-child {
  border-right: 0 !important;
}

.mes-erp-detail__stat:hover {
  background: #f4f8fa;
  color: var(--mes-detail-blue);
}

.mes-erp-detail__stat:focus-visible {
  background: #f4f8fa;
  color: var(--mes-detail-blue);
  outline: 2px solid rgba(8, 125, 185, 0.45);
  outline-offset: -2px;
}

.mes-erp-detail__stat:hover .mes-erp-detail__stat-icon,
.mes-erp-detail__stat:focus-visible .mes-erp-detail__stat-icon,
.mes-erp-detail__stat:hover .mes-erp-detail__stat-value,
.mes-erp-detail__stat:focus-visible .mes-erp-detail__stat-value {
  color: var(--mes-detail-blue);
}

.mes-erp-detail__stat-icon {
  color: #8780b5;
  font-size: 20px;
  text-align: center;
}

.mes-erp-detail__stat-value {
  color: #4a4d50;
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}

.mes-erp-detail__stat-label {
  display: block;
  font-size: 13px;
  line-height: 1.15;
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mes-erp-detail__tabs {
  border-bottom: 1px solid var(--mes-detail-border);
  padding: 0 20px;
}

.mes-erp-detail__tabs .nav-link {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  color: var(--mes-detail-muted);
  font-size: 14px;
  margin-bottom: -1px;
  padding: 11px 16px;
}

.mes-erp-detail__tabs .nav-link:hover {
  color: var(--mes-detail-blue);
}

.mes-erp-detail__tabs .nav-link.active {
  background: #fff;
  border-color: var(--mes-detail-border);
  color: #34383c;
}

.mes-erp-detail__tab-content {
  background: #fff;
  padding: 24px 20px 40px;
}

.mes-erp-detail__content-grid {
  display: grid;
  gap: 34px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
}

.mes-erp-detail__section {
  border: 0;
  margin: 0 0 28px;
}

.mes-erp-detail__section-title {
  border-bottom: 1px solid #e1e1e1;
  color: var(--mes-detail-blue);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  padding: 0 0 7px;
}

.mes-erp-detail__fields {
  display: grid;
  gap: 0 26px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.mes-erp-detail__field {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(125px, 38%) minmax(0, 1fr);
  min-height: 34px;
  padding: 6px 0;
}

.mes-erp-detail__field dt {
  color: #34383c;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.mes-erp-detail__field dd {
  border-left: 1px solid #dedede;
  color: #3e4347;
  font-size: 13px;
  margin: 0;
  min-width: 0;
  padding-left: 10px;
  overflow-wrap: anywhere;
}

.mes-erp-detail__note {
  color: #494d50;
  font-size: 13px;
  line-height: 1.55;
}

.mes-erp-detail__timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mes-erp-detail__timeline li {
  color: var(--mes-detail-muted);
  font-size: 13px;
  padding: 6px 0;
}

.mes-erp-detail__timeline i {
  color: #8780b5;
  margin-right: 6px;
  width: 16px;
}

.mes-erp-detail__table {
  border-color: var(--mes-detail-border);
  font-size: 13px;
}

.mes-erp-detail__table thead th {
  background: #ededed;
  border-color: var(--mes-detail-border);
  color: #34383c;
  font-weight: 700;
}

.mes-erp-detail__table tbody td {
  border-color: #dedede;
}

.mes-erp-detail__table a {
  color: var(--mes-detail-blue);
}

.mes-erp-detail__empty {
  color: var(--mes-detail-muted);
  font-size: 13px;
  padding: 32px;
  text-align: center;
}

/* Full-width transactional documents (receipts, deliveries and transfers). */
.mes-erp-detail--document {
  height: calc(100vh - var(--mes-nav-height));
  min-height: 0;
  overflow: auto;
}

.mes-erp-detail__toolbar-spacer {
  flex: 1 1 40px;
}

.mes-erp-detail__document-status {
  align-items: center;
  background: #ededed;
  border-bottom: 1px solid var(--mes-detail-border);
  display: flex;
  justify-content: flex-end;
  min-height: 48px;
  padding: 4px 18px;
}

.mes-erp-detail__document-status .state-statusbar {
  margin: 0;
  padding: 0;
}

.mes-erp-detail__document-status .state-statusbar__pill {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
  min-height: 30px;
  padding: 4px 8px;
}

.mes-erp-detail__document-status .state-statusbar__marker {
  display: none;
}

.mes-erp-detail__document-status .state-statusbar__connector {
  background: #b9bec2;
  min-width: 20px;
  width: 20px;
}

.mes-erp-detail__document-status .state-statusbar__step.is-current .state-statusbar__pill {
  background: transparent;
  border-bottom: 2px solid var(--mes-detail-blue);
  color: var(--mes-detail-blue);
}

.mes-erp-detail--document .mes-erp-detail__alert {
  border-radius: 0;
  margin: 0;
}

.mes-erp-detail--document .mes-erp-detail__hero {
  min-height: 260px;
  padding: 0 20px 30px;
}

.mes-erp-detail__document {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 0;
}

.mes-erp-detail--document .mes-erp-detail__eyebrow {
  color: var(--mes-detail-muted);
  margin-top: 6px;
}

.mes-erp-detail--document .mes-erp-detail__title {
  font-size: clamp(1.45rem, 2vw, 1.9rem);
}

.mes-erp-detail__document-fields {
  margin-top: 68px;
}

.mes-erp-detail--document .mes-erp-detail__stats {
  align-self: start;
  margin-top: 0;
}

.mes-erp-detail__table-toolbar {
  align-items: center;
  display: flex;
  font-size: 12px;
  justify-content: flex-end;
  min-height: 36px;
}

.mes-erp-detail__table-toolbar .btn {
  border: 0;
  border-radius: 0;
  color: var(--mes-detail-text);
  font-size: 12px;
  font-weight: 600;
  margin-left: 12px;
}

.mes-erp-detail__table-toolbar .btn:hover,
.mes-erp-detail__table-toolbar .btn:focus {
  background: #eef3f6;
  color: var(--mes-detail-blue);
}

.mes-erp-detail__table-toolbar i {
  color: #98a3ab;
  margin-right: 6px;
}

.mes-erp-detail__table-scroll {
  max-height: calc(100vh - 430px);
  min-height: 180px;
  overflow: auto;
}

.mes-erp-detail--document .mes-erp-detail__table {
  min-width: 1250px;
}

.mes-erp-detail--document .mes-erp-detail__table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.mes-erp-detail__related-links {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 7px;
}

.mes-erp-detail__related-links a {
  color: var(--mes-detail-blue);
  text-decoration: none;
}

.mes-erp-detail__related-links a:hover {
  text-decoration: underline;
}

@media (max-width: 991.98px) {
  .mes-production-control-panel .o_control_panel_main {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .mes-production-control-panel__smart-buttons {
    width: 100%;
  }

  .mes-erp-detail__hero,
  .mes-erp-detail__content-grid {
    grid-template-columns: 1fr;
  }

  .mes-erp-detail__hero {
    min-height: 0;
    padding-top: 24px;
  }

  .mes-erp-detail__stats {
    max-width: 100%;
  }

  .mes-erp-detail__document-fields {
    margin-top: 28px;
  }

  .mes-erp-detail__table-scroll {
    max-height: none;
  }
}

@media (max-width: 575.98px) {
  .mes-erp-detail__breadcrumb {
    font-size: 17px;
  }

  .mes-erp-detail__hero {
    padding: 20px 12px;
  }

  .mes-erp-detail__identity {
    gap: 14px;
  }

  .mes-erp-detail__avatar {
    flex-basis: 62px;
    font-size: 30px;
    height: 62px;
  }

  .mes-erp-detail__fields {
    grid-template-columns: 1fr;
  }

  .mes-erp-detail__tabs {
    overflow-x: auto;
    padding: 0 8px;
    white-space: nowrap;
  }

  .mes-erp-detail__tab-content {
    padding: 18px 12px 30px;
  }

  .mes-erp-detail__field {
    grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
  }
}
