/* 現場原料檢核表：滿版表（對齊原料列表），不含文審側欄 */

.onsite-assign-host:not(.hidden) {
  margin-bottom: 0.85rem;
}

.onsite-assign {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 0.85rem 1rem 1rem;
}

.onsite-assign h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.onsite-assign-mode-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.45rem;
  min-width: 0;
}

.onsite-assign-nos {
  font-weight: 600;
  word-break: break-word;
}

.onsite-assign-nos::before {
  content: "：";
  font-weight: 600;
}

.onsite-assign-range-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.onsite-assign-range-row .text-input {
  flex: 1;
  min-width: 0;
}

.onsite-assign-count {
  margin: 0.45rem 0 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.onsite-assign-selected,
.onsite-assign-hits {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.onsite-assign-selected {
  max-height: min(36vh, 280px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem 0.5rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.onsite-assign-hit {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  font-size: 0.88rem;
}

.onsite-assign-hit:hover {
  border-color: var(--accent);
}

.case-onsite-material-layout {
  min-width: 0;
}

.case-onsite-material-layout .materials-workspace {
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem 1rem 1rem;
}

.case-onsite-material-layout .table-scroll {
  max-height: min(72vh, 780px);
}

.onsite-mat-table {
  table-layout: fixed;
  min-width: 880px;
}

.onsite-mat-table th,
.onsite-mat-table td {
  white-space: normal;
  word-break: break-word;
}

.onsite-mat-table th {
  text-align: left;
  line-height: 1.25;
  font-size: 1rem;
  color: var(--text);
}

.onsite-mat-table th:nth-child(1),
.onsite-mat-table td:nth-child(1) { width: 3.4rem; text-align: center; }
.onsite-mat-table th:nth-child(2),
.onsite-mat-table td:nth-child(2) { width: 4.8rem; white-space: nowrap; }
.onsite-mat-table th:nth-child(3),
.onsite-mat-table td:nth-child(3) { width: 12%; }
.onsite-mat-table th:nth-child(4),
.onsite-mat-table td:nth-child(4) { width: 10%; }
.onsite-mat-table th:nth-child(5),
.onsite-mat-table td:nth-child(5) { width: 7%; }
.onsite-mat-table th:nth-child(6),
.onsite-mat-table td:nth-child(6) { width: 9%; }
.onsite-mat-table th:nth-child(7),
.onsite-mat-table td:nth-child(7) { width: 10%; }
.onsite-mat-table th:nth-child(8),
.onsite-mat-table td:nth-child(8) { width: 9%; }
.onsite-mat-table th:nth-child(9),
.onsite-mat-table td:nth-child(9) { width: 8rem; }

.onsite-mat-table tr.is-assigned {
  background: rgba(15, 118, 110, 0.06);
}

.onsite-mat-table th:last-child,
.onsite-mat-table td:last-child {
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -8px 0 10px -8px rgba(15, 23, 42, 0.18);
}

.onsite-mat-table th:last-child {
  z-index: 3;
  background: var(--surface-2);
}

.onsite-mat-table td:last-child {
  z-index: 1;
}

.onsite-mat-table tr.is-assigned td:last-child {
  background: #eef6f5;
}

.onsite-mat-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}

.onsite-mat-name-en {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.onsite-mat-compare {
  vertical-align: top;
  padding: 0.4rem 0.5rem;
}

.onsite-mat-opt + .onsite-mat-opt {
  margin-top: 0.25rem;
}

.onsite-mat-compare .check-item {
  min-height: 2.2rem;
  padding: 0.35rem 0.45rem;
  gap: 0.35rem;
}

.onsite-mat-compare .check-item.is-on {
  background: rgba(15, 118, 110, 0.16);
  outline: 1px solid var(--accent);
}

.onsite-mat-expand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.3rem 0 0 0.15rem;
  padding: 0.35rem 0.4rem 0.45rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.onsite-mat-expand .check-item {
  margin: 0;
}

.onsite-mat-side-note {
  margin: 0.35rem 0 0;
}

.onsite-mat-compare textarea {
  width: 100%;
  min-height: 2.4rem;
  resize: vertical;
  font: inherit;
}

.case-onsite-material-layout .review-btns {
  margin-top: 0.85rem;
  grid-template-columns: max-content;
}

@media (max-width: 900px) {
  .onsite-assign-range-row {
    flex-direction: column;
    align-items: stretch;
  }

  .onsite-mat-table {
    min-width: 760px;
  }

  .onsite-mat-table th:nth-child(9),
  .onsite-mat-table td:nth-child(9) { width: 6.5rem; }

  .onsite-mat-compare .check-item {
    min-height: 2rem;
    padding: 0.28rem 0.35rem;
    font-size: 0.8rem;
  }
}
