/* โมดูลบันทึกสาเหตุ - ทุก selector ขึ้นต้นด้วย .ent- */

/* ตัวเลขงานค้าง อยู่ในหัวโมดูลที่เป็นเจ้าของ ไม่ไปเกะกะ navbar ส่วนกลาง */
.ent-counts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ent-count {
  font-size: 13px;
  color: var(--oee-muted);
  background: var(--oee-bg);
  border: 1px solid var(--oee-line);
  border-radius: 20px;
  padding: 4px 12px;
}
.ent-count b { color: var(--oee-text); font-size: 14px; }
.ent-count-ok b { color: var(--oee-ok); }
.ent-count-warn { background: #fff5e6; border-color: #f0d7ad; }
.ent-count-warn b { color: var(--oee-warn); }

/* ตาราง + แผงกรอก */
.ent-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  padding: 14px 16px 0;
  align-items: start;
}
.ent-listwrap {
  background: var(--oee-surface);
  border: 1px solid var(--oee-line);
  border-radius: 10px;
  overflow: hidden;
}
.ent-panel {
  background: var(--oee-surface);
  border: 1px solid var(--oee-line);
  border-radius: 10px;
  padding: 16px;
  position: sticky;
  top: 14px;
}

/* แถวในตารางคลิกได้ และแถวที่เลือกอยู่ต้องเห็นชัดตอนเลื่อนด้วยลูกศร */
.ent-listwrap table.oee-table tbody tr { cursor: pointer; }
.ent-listwrap table.oee-table tbody tr.ent-row-on {
  background: var(--oee-sel);
  box-shadow: inset 3px 0 0 var(--oee-accent);
}

.ent-head { border-bottom: 1px solid var(--oee-line); padding-bottom: 12px; margin-bottom: 14px; }
.ent-dur { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ent-when { font-size: 13px; color: var(--oee-muted); margin-top: 2px; }
.ent-mc { font-size: 13px; color: var(--oee-muted); }

/* ช่องรหัส - ตัวใหญ่เพราะเป็นช่องเดียวที่ต้องพิมพ์ และพิมพ์ซ้ำ ๆ ทั้งกะ */
.ent-code {
  width: 100%;
  padding: 12px;
  font-size: 22px;
  font-weight: 700;
  /* ช่องรหัส - ใช้ฟอนต์ตัวเลขเพื่อให้แยก 0 กับ O และ 1 กับ l ออกจากกันชัด */
  font-family: var(--oee-font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  text-align: center;
  border: 2px solid var(--oee-line);
  border-radius: var(--oee-radius);
  background: #fff;
  color: var(--oee-text);
}
.ent-code:focus {
  outline: none;
  border-color: var(--oee-accent);
  box-shadow: 0 0 0 3px rgba(11, 107, 203, .15);
}

/* ยืนยันว่ารหัสที่พิมพ์คือสาเหตุอะไร ก่อนกด Enter */
.ent-preview {
  min-height: 40px;
  margin: -6px 0 14px;
  padding: 9px 12px;
  border-radius: var(--oee-radius);
  background: var(--oee-bg);
  font-size: 13px;
  color: var(--oee-muted);
}
.ent-preview-ok { background: #eaf6ee; color: #14603a; }
.ent-preview-bad { background: #fdecec; color: var(--oee-danger); }

.ent-kindtoggle { display: flex; gap: 6px; }
.ent-kind {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 6px;
  border: 1px solid var(--oee-line);
  border-radius: var(--oee-radius);
  background: #fff;
  cursor: pointer;
  color: var(--oee-muted);
}
.ent-kind-on { background: var(--oee-accent); border-color: var(--oee-accent); color: #fff; font-weight: 600; }

.ent-actions { display: flex; flex-direction: column; gap: 8px; margin: 18px 0 14px; }

.ent-reasonlist { margin-bottom: 14px; }
.ent-reasonlist summary { cursor: pointer; font-size: 13px; color: var(--oee-accent); }
.ent-rlist { margin-top: 10px; max-height: 260px; overflow-y: auto; font-size: 13px; }
.ent-rlist div { padding: 5px 0; border-bottom: 1px solid #eef1f4; display: flex; gap: 8px; }
.ent-rlist b { font-family: var(--oee-font-num); font-variant-numeric: tabular-nums; }

.ent-keyhelp {
  border-top: 1px solid var(--oee-line);
  padding-top: 12px;
  font-size: 12px;
  color: var(--oee-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.ent-keyhelp b { width: 100%; color: var(--oee-text); }
.ent-keyhelp .oee-kbd { background: #fff; }

@media (max-width: 900px) {
  .ent-main { grid-template-columns: 1fr; }
  .ent-panel { position: static; order: -1; }
}
@media (max-width: 640px) {
  .ent-listwrap table.oee-table th:nth-child(4),
  .ent-listwrap table.oee-table td:nth-child(4) { display: none; }
}

/* ป้ายบอกว่าข้อมูลบนจอสดแค่ไหน และเตือนเมื่อรอบ auto refresh ถูกเลื่อน
   เพราะกำลังกรอกอยู่ (ระบบจะตามเก็บให้เองหลังบันทึก) */
.ent-fresh { font-size: 12px; color: var(--oee-muted); white-space: nowrap; }
.ent-fresh-hold {
  color: var(--oee-warn);
  background: #fff5e6;
  border: 1px solid #f0d7ad;
  border-radius: 20px;
  padding: 3px 10px;
}

/* แท็บ "ทั้งหมด" - Minor Stoppage โชว์จาง ๆ เพราะดูอย่างเดียว ไม่ใช่งานที่ต้องทำ */
.ent-row-minor { opacity: .62; }
.ent-row-minor:hover { opacity: 1; }
.ent-dim { color: var(--oee-muted); font-size: 12px; }
.ent-badge-minor { background: #eef1f4; color: var(--oee-muted); border-color: var(--oee-line); }
.ent-badge-downtime { background: #fdecec; color: var(--oee-danger); border-color: #f6cccc; }

/* แผงขวาตอนเลือกแถว Minor - อธิบายว่าทำไมไม่ต้องกรอก */
.ent-minorbox { padding: 2px; }
.ent-minortext { font-size: 13px; color: var(--oee-muted); line-height: 1.65; margin: 12px 0 0; }
.ent-minortext b { color: var(--oee-text); }
