/* ─── Phân công ca — PLX Shift Schedule ─── */

.page-phancong .section {
  padding: 14px;
}

/* Collapsible section header */
.phancog-head {
  width: 100%;
  padding: 10px 14px;
  font-weight: 700;
  font-size: .9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  margin-bottom: 10px;
  color: var(--text-heading);
  transition: background var(--anim), border-left-color var(--anim);
}

.phancog-head:hover {
  background: rgba(var(--primary-rgb), .06);
  border-left-color: var(--accent);
  box-shadow: none;
}

/* ─── PLX Shift Grid (B3-E) ─── */

/* Step 4 (UI-R04): wrapper cho horizontal scroll trên mobile */
.shift-grid-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

@media (min-width: 900px) {
  .shift-grid-wrap {
    max-width: none;
    width: 100%;
    margin-inline: 0;
  }
}



.shift-grid-wrap::-webkit-scrollbar {
  height: 4px;
}
.shift-grid-wrap::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 2px;
}

.shift-grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  min-width: 560px; /* prevent collapse */
}

.shift-grid th {
  background: var(--surface-2);
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--text-body);
  font-weight: 600;
  border-bottom: 2px solid var(--primary);
  padding: 12px 8px;
  text-align: left;
  white-space: nowrap;
}

.shift-grid th small {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0;
  font-weight: 400;
  text-transform: none;
  opacity: 0.75;
  margin-top: 2px;
}

.shift-grid__person-header {
  min-width: 180px;
}

.shift-grid td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.shift-grid tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.04);
}

.shift-grid__person {
  min-width: 180px;
}

.shift-grid__name {
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.3;
}

.shift-grid__chxd {
  font-size: 0.75rem;
  color: var(--text-body);
  margin: 2px 0 0;
}

/* Shift blocks */
.shift-block {
  padding: 8px 10px;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  line-height: 1.3;
}

.shift-block--sang {
  border-left: 3px solid var(--primary);
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--text-main);
  cursor: pointer;
}

.shift-block--sang:hover {
  background: rgba(var(--primary-rgb), 0.12);
}

.shift-block--chieu {
  border-left: 3px solid var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text-main);
  cursor: pointer;
}

.shift-block--chieu:hover {
  background: rgba(var(--accent-rgb), 0.12);
}

.shift-block--dem {
  border-left: 3px solid var(--ca-3-color);
  background: var(--ca-3-bg);
  color: var(--text-main);
  cursor: pointer;
}

.shift-block--dem:hover {
  background: rgba(var(--ca-3-color-rgb), 0.12);
}

.shift-block--off {
  color: var(--text-body);
  font-style: italic;
  font-size: 0.8125rem;
}

/* CHXD group container */
.pc-group {
  margin-bottom: 20px;
}

.pc-group__count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
  padding-left: 8px;
}

/* Input trong ô ca — minimal style */
.phancog-table td input {
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(0,0,0,0.03);
  border-radius: 0;
  padding: 4px 6px;
  min-height: auto;
  height: 38px;
  width: 100%;
  font-size: .9rem;
  color: var(--text-main);
  font-weight: 700; /* Làm chữ đậm hơn để dễ nhìn */
  transition: all var(--anim);
}

.phancog-table td input:focus {
  border-bottom-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.02);
}

.phancog-table td input:focus {
  border-bottom-color: var(--primary);
  box-shadow: none;
  outline: none;
}

.phancog-table td input[readonly] {
  cursor: default;
  color: var(--text-body);
}

/* Cột STT hẹp hơn */
.phancog-table td:first-child,
.phancog-table th:first-child {
  width: 40px;
  text-align: center;
}

/* Cột lưu nhỏ */
.phancog-table td:last-child {
  width: 44px;
  text-align: center;
}

/* ─── Shift inline text input (overview grid) ─── */
.shift-inline-text {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(0,0,0,0.06);
  border-radius: 0;
  padding: 6px 8px;
  font-size: 0.875rem;
  color: var(--text-main);
  font-weight: 600;
  min-width: 80px;
  transition: border-color var(--anim), background var(--anim);
}

.shift-inline-text:focus {
  outline: none;
  background: rgba(var(--primary-rgb), 0.03);
}

.shift-inline-text--sang:focus  { border-bottom-color: var(--primary); }
.shift-inline-text--chieu:focus { border-bottom-color: var(--accent); }
.shift-inline-text--dem:focus   { border-bottom-color: var(--ca-3-color); }

/* Pending/locked state — row chờ duyệt */
.shift-block--pending {
  opacity: 0.65;
  cursor: default;
  color: var(--text-body);
  background: rgba(var(--accent-rgb), .06) !important;
  border-left-color: var(--accent) !important;
}

/* ─── Desktop Optimization (v1001.7) ─── */
@media (min-width: 900px) {
  .phancog-table {
    width: 100% !important;
    table-layout: fixed !important;
  }

  .phancog-table td input {
    height: 32px;
    font-size: 0.875rem;
  }

  /* Cố định chiều rộng các cột chức năng */
  .phancog-table th:first-child, 
  .phancog-table td:first-child { 
    width: 50px !important; 
  }
  
  .phancog-table th:last-child, 
  .phancog-table td:last-child { 
    width: 100px !important; 
  }

  /* Các cột ca chia đều không gian */
  .phancog-table th:nth-child(3),
  .phancog-table th:nth-child(4),
  .phancog-table th:nth-child(5) {
    width: 180px;
  }
}
