/* Source: BMS Xốp Mê Linh frontend/bms-workflow-v8.css — hai khối của màn Dashboard bản Xốp Mê Linh:
   «Theo dõi sản xuất 24 giờ» (section#xopDashboardDaySchedule.xop-dashboard-day-schedule) và
   «Lệnh sản xuất chờ duyệt» (section#xopDashboardApprovals.xop-dashboard-approvals).
   Dòng nguồn đã trích: 1788–2241 (khối chính), 2265–2288 (trong @media max-width: 900px, mở ở dòng 2243),
   5065–5074 và 5196–5311 (trong @media max-width: 760px, mở ở dòng 5038).
   Hàm dựng: frontend/app.js:3332-3367 renderXopDashboardDaySchedule() (phụ trợ xopDashboardOrderState() 3320-3327,
   xopDashboardOrderRanges() 3328-3331) và frontend/app.js:3429-3441 renderXopDashboardApprovals().
   Thân rule giữ nguyên từng ký tự; thay đổi duy nhất là tiền tố phạm vi:
       body.bms-opendesign-v8[data-business-profile="XOP_ME_LINH"]                          →  #dashboardSchedule
       body.bms-opendesign-v8[data-business-profile="XOP_ME_LINH"] .panel[data-panel="dashboard"]  →  #dashboardSchedule
       body.bms-opendesign-v8 .panel[data-panel="dashboard"]                                →  #dashboardSchedule
   (hook gốc là hồ sơ nghiệp vụ Xốp Mê Linh + panel dashboard; Zamio bọc cả hai khối trong một phần tử #dashboardSchedule.)
   Không có rule nào của hai khối phụ thuộc theme .bms-dark-executive nên không phải bỏ rule nào.
   File nằm ngoài core cascade. */

#dashboardSchedule { grid-column: 1 / -1; }

/* ===== NGUỒN: frontend/bms-workflow-v8.css, dòng 1788–2241 ===== */
#dashboardSchedule .xop-dashboard-approvals {
  display: grid;
  gap: var(--bms-space-2);
  margin-top: var(--bms-space-3);
  padding: var(--bms-space-3);
  border: 1px solid var(--bms-border);
  border-radius: var(--bms-radius-3);
  background: var(--bms-surface);
  box-shadow: var(--bms-shadow-1);
}

#dashboardSchedule .xop-dashboard-approvals[hidden] {
  display: none;
}

#dashboardSchedule .xop-dashboard-approvals > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--bms-space-4);
}

#dashboardSchedule .xop-dashboard-approvals > header :is(strong) {
  margin-top: 2px;
}

#dashboardSchedule .xop-dashboard-approvals > header div {
  display: grid;
  gap: 3px;
}

#dashboardSchedule .xop-dashboard-approvals > header .xop-dashboard-approval-heading-actions {
  display: flex;
  align-items: center;
  gap: var(--bms-space-2);
}

#dashboardSchedule .xop-dashboard-approvals > header :is(h3, p) {
  margin: 0;
}

#dashboardSchedule .xop-dashboard-approvals > header span {
  color: var(--bms-primary);
  font: 700 10px/1.2 var(--bms-font-ui);
  letter-spacing: .05em;
}

#dashboardSchedule .xop-dashboard-approvals > header p {
  color: var(--bms-text-muted);
  font-size: 12px;
}

#dashboardSchedule .xop-dashboard-approvals table {
  min-width: 1120px;
  width: 100%;
  border-collapse: collapse;
}

#dashboardSchedule .xop-dashboard-approvals :is(th, td) {
  padding: 10px;
  border-bottom: 1px solid var(--bms-border);
  font-size: 11px;
  text-align: left;
}

#dashboardSchedule .xop-dashboard-approvals th {
  color: var(--bms-text-muted);
  background: var(--bms-surface-subtle, var(--bms-surface));
  text-transform: uppercase;
}

#dashboardSchedule .xop-dashboard-approvals td small {
  display: block;
  color: var(--bms-text-muted);
}

#dashboardSchedule .xop-dashboard-approval-actions {
  display: flex;
  gap: var(--bms-space-2);
}

#dashboardSchedule .xop-dashboard-day-schedule {
  display: grid;
  grid-column: 1 / -1;
  gap: var(--bms-space-2);
  min-width: 0;
  min-height: 0;
  padding: var(--bms-space-3);
  border-color: color-mix(in srgb, var(--bms-primary) 22%, var(--bms-border));
}

#dashboardSchedule .xop-dashboard-day-schedule[hidden] {
  display: none;
}

#dashboardSchedule .xop-dashboard-day-schedule > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bms-space-3);
  margin-bottom: 0;
}

#dashboardSchedule .xop-dashboard-schedule-heading {
  display: flex;
  align-items: center;
  gap: var(--bms-space-3);
  min-width: 0;
}

#dashboardSchedule .xop-dashboard-day-schedule > header :is(h3, p) {
  margin: 0;
}

#dashboardSchedule .xop-dashboard-day-schedule > header p {
  color: var(--bms-text-muted);
  font-size: 11px;
  line-height: 1.45;
  text-wrap: pretty;
}

#dashboardSchedule .xop-dashboard-date-control {
  display: flex;
  align-items: center;
  gap: var(--bms-space-2);
  flex: 0 0 auto;
}

#dashboardSchedule .xop-dashboard-date-control :is(button, input) {
  height: 36px;
  min-height: 36px;
  border-radius: var(--bms-radius-1);
}

#dashboardSchedule .xop-dashboard-date-control button:not(#xopDashboardScheduleToday) {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

#dashboardSchedule #xopDashboardScheduleToday {
  min-width: 76px;
  padding-inline: var(--bms-space-3);
  white-space: nowrap;
}

#dashboardSchedule .xop-dashboard-date-control input {
  width: 132px;
  padding-inline: var(--bms-space-3);
  font: 650 11px/1 var(--bms-font-data);
}

#dashboardSchedule .xop-dashboard-schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bms-space-1) var(--bms-space-3);
  padding-inline-start: var(--bms-space-3);
  border-inline-start: 1px solid color-mix(in srgb, var(--bms-border) 88%, transparent);
  margin-top: 0;
  color: var(--bms-text-muted);
  font-size: 9px;
  line-height: 1.2;
}

#dashboardSchedule .xop-dashboard-day-schedule > header .xop-dashboard-schedule-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--bms-text-muted);
  font: 550 9px/1.2 var(--bms-font-ui);
  letter-spacing: 0;
  text-transform: none;
}

#dashboardSchedule .xop-dashboard-schedule-legend i {
  width: 7px;
  height: 7px;
  border-radius: var(--bms-radius-round);
  background: var(--xop-hour-color);
}

#dashboardSchedule .xop-dashboard-schedule-legend .is-pending,
#dashboardSchedule :is(.xop-dashboard-hour, .xop-dashboard-order-status).is-pending {
  --xop-hour-color: var(--bms-warning);
}

#dashboardSchedule .xop-dashboard-schedule-legend .is-ready,
#dashboardSchedule :is(.xop-dashboard-hour, .xop-dashboard-order-status).is-ready {
  --xop-hour-color: var(--bms-info, var(--bms-primary));
}

#dashboardSchedule .xop-dashboard-schedule-legend .is-running,
#dashboardSchedule :is(.xop-dashboard-hour, .xop-dashboard-order-status).is-running {
  --xop-hour-color: var(--bms-primary);
}

#dashboardSchedule .xop-dashboard-schedule-legend .is-paused,
#dashboardSchedule :is(.xop-dashboard-hour, .xop-dashboard-order-status).is-paused {
  --xop-hour-color: var(--bms-danger);
}

#dashboardSchedule .xop-dashboard-schedule-legend .is-completed,
#dashboardSchedule :is(.xop-dashboard-hour, .xop-dashboard-order-status).is-completed {
  --xop-hour-color: var(--bms-success);
}

#dashboardSchedule .xop-dashboard-24h-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--bms-border) 88%, transparent);
  border-radius: var(--bms-radius-2);
  background: var(--bms-surface);
  scrollbar-color: var(--bms-border-strong) var(--bms-surface-subtle);
  overscroll-behavior-inline: contain;
}

#dashboardSchedule .xop-dashboard-24h-table {
  width: 100%;
  min-width: 1220px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: var(--bms-surface);
}

#dashboardSchedule .xop-dashboard-24h-table :is(th, td) {
  height: 36px;
  padding: 7px 10px;
  border-right: 1px solid color-mix(in srgb, var(--bms-border) 76%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--bms-border) 82%, transparent);
  color: var(--bms-text);
  font-size: 10px;
  text-align: left;
  vertical-align: middle;
}

#dashboardSchedule .xop-dashboard-24h-table th {
  color: var(--bms-text-muted);
  background: var(--bms-surface-subtle, var(--bms-surface));
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

#dashboardSchedule .xop-dashboard-24h-table thead tr:first-child th:nth-child(n+5) {
  color: var(--bms-text-muted);
  background: color-mix(in srgb, var(--bms-surface-subtle) 72%, var(--bms-surface));
}

#dashboardSchedule .xop-dashboard-24h-table thead tr:last-child th {
  height: 32px;
  color: var(--bms-text-subtle);
  font: 650 9px/1 var(--bms-font-data);
  letter-spacing: 0;
}

#dashboardSchedule .xop-dashboard-24h-table tbody td {
  height: 44px;
}

#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(1) { width: 120px; }
#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(2) { width: 82px; }
#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(3) { width: 96px; }
#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(4) { width: 92px; }

#dashboardSchedule .xop-dashboard-24h-table thead tr:last-child th,
#dashboardSchedule .xop-dashboard-24h-table tbody td:nth-child(n+5) {
  width: 33px;
  min-width: 33px;
  padding-inline: 2px;
  text-align: center;
  border-right: 0;
}

#dashboardSchedule .xop-dashboard-24h-table tbody td:nth-child(-n+4),
#dashboardSchedule .xop-dashboard-24h-table thead tr:first-child th:nth-child(-n+4) {
  position: sticky;
  z-index: 2;
  background: var(--bms-surface);
}

#dashboardSchedule .xop-dashboard-24h-table thead tr:first-child th:nth-child(-n+4) {
  z-index: 4;
  background: var(--bms-surface-subtle, var(--bms-surface));
}

#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(1) { left: 0; }
#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(2) { left: 120px; }
#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(3) { left: 202px; }
#dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(4) { left: 298px; box-shadow: 5px 0 8px color-mix(in srgb, var(--bms-text) 6%, transparent); }

#dashboardSchedule .xop-dashboard-24h-table tbody td:nth-child(2) {
  padding-inline: 8px;
}

#dashboardSchedule .xop-dashboard-24h-table tbody td:nth-child(2) strong {
  font-size: 10px;
}

#dashboardSchedule .xop-dashboard-24h-table tbody tr:hover td {
  background-color: color-mix(in srgb, var(--bms-primary) 3%, var(--bms-surface));
}

#dashboardSchedule .xop-dashboard-24h-table td:first-child button {
  display: block;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--bms-primary);
  background: transparent;
  font: 700 11px/1.3 var(--bms-font-data);
  text-align: left;
  text-overflow: ellipsis;
  white-space: normal;
  cursor: pointer;
}

#dashboardSchedule .xop-dashboard-24h-table td small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--bms-text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dashboardSchedule .xop-dashboard-hour {
  position: relative;
  --bar-color: var(--xop-hour-color);
}

#dashboardSchedule .xop-dashboard-hour.is-filled::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 10px 0;
  background: color-mix(in srgb, var(--xop-hour-color) 11%, var(--bms-surface));
}

#dashboardSchedule .xop-dashboard-hour.is-progress-filled::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 10px 0;
  background: color-mix(in srgb, var(--xop-hour-color) 84%, var(--bms-surface));
}

#dashboardSchedule .xop-dashboard-hour.is-start::before {
  left: 4px;
  border-radius: 999px 0 0 999px;
}

#dashboardSchedule .xop-dashboard-hour.is-end::before {
  right: 4px;
  border-radius: 0 999px 999px 0;
}

#dashboardSchedule .xop-dashboard-hour.is-start.is-end::before {
  border-radius: 999px;
}

#dashboardSchedule .xop-dashboard-hour.is-progress-filled.is-start::after {
  left: 4px;
  border-radius: 999px 0 0 999px;
}

#dashboardSchedule .xop-dashboard-hour.is-progress-end::after {
  right: 3px;
  border-radius: 0 999px 999px 0;
}

#dashboardSchedule .xop-dashboard-hour.is-progress-end.is-start::after {
  border-radius: 999px;
}

#dashboardSchedule .xop-dashboard-progress-trigger {
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
}

#dashboardSchedule .xop-dashboard-progress-trigger .production-progress__eye-ring {
  width: 18px;
  height: 18px;
  background: color-mix(in srgb, var(--xop-hour-color) 72%, var(--bms-surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--xop-hour-color) 12%, transparent);
}

#dashboardSchedule .xop-dashboard-progress-trigger .production-progress__eye-core {
  width: 6px;
  height: 6px;
  background: var(--bms-surface);
}

#dashboardSchedule .xop-dashboard-progress-trigger:is(:hover, :focus-visible) .production-progress__eye-ring {
  width: 22px;
  height: 22px;
  background: color-mix(in srgb, var(--xop-hour-color) 84%, var(--bms-surface));
}

#dashboardSchedule .xop-dashboard-progress-trigger::after {
  content: "Mở nhật ký sản xuất";
}

#dashboardSchedule .xop-dashboard-hour-progress {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 8px;
  color: var(--bms-text);
  font: 700 9px/1 var(--bms-font-data);
  font-variant-numeric: tabular-nums;
  transform: translateY(-50%);
  white-space: nowrap;
}

#dashboardSchedule .xop-dashboard-hour.is-progress-filled .xop-dashboard-hour-progress {
  color: var(--bms-surface);
}

#dashboardSchedule .xop-dashboard-24h-table .is-now {
  box-shadow: inset 1px 0 0 var(--bms-primary);
}

#dashboardSchedule .xop-dashboard-24h-table thead .is-now {
  color: var(--bms-primary);
  background: var(--bms-primary-soft);
}

#dashboardSchedule .xop-dashboard-24h-table .is-shift-start {
  border-left: 1px solid color-mix(in srgb, var(--bms-primary) 28%, var(--bms-border));
}

#dashboardSchedule .xop-dashboard-order-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--xop-hour-color) 28%, var(--bms-border));
  border-radius: var(--bms-radius-round);
  color: color-mix(in srgb, var(--xop-hour-color) 82%, var(--bms-text));
  background: color-mix(in srgb, var(--xop-hour-color) 8%, var(--bms-surface));
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== NGUỒN: dòng 2243 @media (max-width: 900px), các rule 2265–2288 ===== */
@media (max-width: 900px) {
  #dashboardSchedule :is(.xop-dashboard-approvals > header, .xop-production-order-document-head) {
    align-items: stretch;
    flex-direction: column;
  }

  #dashboardSchedule .xop-dashboard-day-schedule > header {
    align-items: stretch;
    flex-direction: column;
  }

  #dashboardSchedule .xop-dashboard-schedule-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--bms-space-1);
  }

  #dashboardSchedule .xop-dashboard-schedule-legend {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  #dashboardSchedule .xop-dashboard-date-control {
    flex-wrap: wrap;
  }
}

/* ===== NGUỒN: dòng 5038 @media (max-width: 760px), các rule 5065–5074 và 5196–5311 ===== */
@media (max-width: 760px) {
  #dashboardSchedule .xop-dashboard-date-control {
    flex-wrap: nowrap;
    width: 100%;
  }

  #dashboardSchedule .xop-dashboard-date-control input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }
  #dashboardSchedule :is(.dashboard-insight-card, .xop-dashboard-day-schedule > header, .xop-dashboard-schedule-heading, .xop-dashboard-approvals, .xop-dashboard-approvals > header) {
    min-width: 0;
    max-width: 100%;
  }

  #dashboardSchedule .xop-dashboard-schedule-legend {
    flex-wrap: wrap;
  }

  #dashboardSchedule .xop-dashboard-date-control {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto 36px;
    gap: 6px;
  }

  #dashboardSchedule .xop-dashboard-date-control input {
    width: 100%;
    padding-inline: 6px;
  }

  #dashboardSchedule #xopDashboardScheduleToday {
    min-width: 0;
    padding-inline: 10px;
  }

  #dashboardSchedule .xop-dashboard-24h-table tbody td:is(:nth-child(2), :nth-child(3), :nth-child(4)),
  #dashboardSchedule .xop-dashboard-24h-table thead tr:first-child th:is(:nth-child(2), :nth-child(3), :nth-child(4)) {
    position: static;
    box-shadow: none;
  }

  #dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(1) {
    width: 104px;
    box-shadow: 5px 0 8px color-mix(in srgb, var(--bms-text) 6%, transparent);
  }

  #dashboardSchedule .xop-dashboard-24h-table tbody td:nth-child(1) {
    z-index: 8;
  }

  #dashboardSchedule .xop-dashboard-24h-table thead tr:first-child th:nth-child(1) {
    z-index: 9;
  }

  /* Machine and plan columns are secondary on a phone; the order code, status and hour strip stay visible together. */
  #dashboardSchedule .xop-dashboard-24h-table :is(th, td):is(:nth-child(2), :nth-child(3)) { display: none; }
  #dashboardSchedule .xop-dashboard-24h-table :is(th, td):nth-child(4) { width: 82px; padding-inline: 6px; }

  #dashboardSchedule .xop-dashboard-24h-table thead tr:last-child th,
  #dashboardSchedule .xop-dashboard-24h-table tbody td:nth-child(n+5) {
    width: 28px;
    min-width: 28px;
  }

  #dashboardSchedule .xop-dashboard-24h-table {
    min-width: 858px;
  }

  #dashboardSchedule .xop-dashboard-approvals table {
    min-width: 0;
  }

  #dashboardSchedule .xop-dashboard-approvals thead {
    display: none;
  }

  #dashboardSchedule .xop-dashboard-approvals tbody {
    display: block;
  }

  #dashboardSchedule .xop-dashboard-approvals tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--bms-border);
  }

  #dashboardSchedule .xop-dashboard-approvals tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  #dashboardSchedule .xop-dashboard-approvals tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 1px;
    color: var(--bms-text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  #dashboardSchedule .xop-dashboard-approvals tbody td:is(:nth-child(2), :nth-child(4), :last-child),
  #dashboardSchedule .xop-dashboard-approvals tbody td.empty-cell {
    grid-column: 1 / -1;
  }

  #dashboardSchedule .xop-dashboard-approvals tbody td:nth-child(2) strong {
    font-size: 14px;
  }

  #dashboardSchedule .xop-dashboard-approvals tbody td select {
    width: 100%;
  }

  #dashboardSchedule .xop-dashboard-approval-actions {
    margin-top: 4px;
  }

  #dashboardSchedule .xop-dashboard-approval-actions .btn {
    flex: 1 1 0;
  }
}
