/* 開口合約與出貨通知單（app/open_contract.js） */
.oc-purchase-box { display: grid; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid #d9d2c5; border-radius: 8px; background: #fbf8f2; }
.oc-purchase-box.is-open-contract { border-color: #b98a2f; background: #fff8ea; }
.oc-kind-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.oc-kind-row select { width: auto; min-width: 10em; margin: 0; }
/* 合約型態標題與內容的字級同「採購單號」欄位標題 */
.oc-kind-row .field-caption, .oc-kind-row strong { font-size: var(--ui-label-size); }
.oc-contract-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.oc-contract-fields .po-field { min-width: 0; }
.oc-project-locked input { background: #f1ede5; }
.oc-project-locked .autocomplete-field { pointer-events: none; }

.oc-quota { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0; padding: 8px 10px; border-radius: 6px; background: #eef4f0; color: #1f2421; }
.oc-quota.oc-quota-low { background: #fff1db; border: 1px solid #d48a1a; }
.oc-quota-warning { flex: 1 1 100%; color: #9a5b00; font-weight: 700; }
.oc-quota-low-text { color: #9a5b00; font-weight: 700; }
.oc-acceptance-info { margin-top: 4px; }
.oc-acceptance-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: #e7eef8; color: #1c3d63; font-size: 0.85em; line-height: 22px; white-space: nowrap; }
.oc-acceptance-badge.oc-quota-low { background: #fff1db; color: #9a5b00; }
.oc-detail-contract { margin-bottom: 10px; }

.oc-calloff-panel .acceptance-search-section { margin-bottom: 12px; }
.oc-calloff-panel .oc-delivery-filter .row .checkline { display: inline-flex; align-items: center; gap: 6px; width: auto; white-space: nowrap; }
.oc-calloff-panel .oc-delivery-filter input[type="radio"] { width: 18px; height: 18px; min-width: 18px; padding: 0; flex: 0 0 18px; }
.oc-lines-row > td { background: #faf7f1; padding: 6px 8px 10px 36px; }
.oc-contract-lines { width: 100%; }
.oc-row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.oc-unread, .oc-needs-action { flex: 0 0 auto; margin-left: 4px; padding: 0 6px; border-radius: 10px; font-size: 0.8em; line-height: 20px; align-self: center; }
.oc-unread { background: #c0392b; color: #fff; }
.oc-needs-action { background: #d48a1a; color: #fff; }
.oc-unread-item { font-weight: 700; }
.oc-home-notice { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }

.oc-form-grid, .oc-mail-grid, .oc-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.oc-detail-grid { gap: 4px 14px; margin-bottom: 8px; }
.oc-form-grid .oc-wide, .oc-mail-grid .oc-wide { grid-column: 1 / -1; }
.oc-form-grid label, .oc-mail-grid label { min-width: 0; }
.oc-line-table td { vertical-align: top; }
.oc-line-table .oc-line-qty { width: 7em; }
.oc-line-table .oc-line-date { width: 10em; }
.oc-line-table .oc-line-note { min-width: 8em; }
.oc-line-table input[type="checkbox"] { width: 18px; height: 18px; }
.oc-line-table tr.oc-line-selected td { background: #f3f8f3; }
.oc-line-total { white-space: nowrap; }
.oc-form-status { overflow-wrap: anywhere; }
.oc-form-error { color: #b3261e; min-height: 1.2em; margin: 4px 0; }
.oc-notifications { margin: 4px 0 8px; padding-left: 1.2em; }
.oc-detail-actions { margin-top: 10px; flex-wrap: wrap; }
.oc-reason-dialog .dialog-shell { display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); }
.oc-reason-dialog textarea { width: 100%; }

@media (max-width: 900px) {
  .oc-contract-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .oc-contract-fields, .oc-form-grid, .oc-mail-grid, .oc-detail-grid { grid-template-columns: 1fr; }
  .oc-lines-row > td { padding-left: 8px; }
  .oc-row-actions button { flex: 1 1 auto; }
}

/* 開口合約財務：月結請款彙總（app/open_contract_finance.js）與財務清單的出貨通知單標示（app/finance.js） */
.finance-order-kind { display: block; color: #1c3d63; font-size: 0.85em; white-space: nowrap; }
.ocf-info { margin: 6px 0; padding: 8px 10px; border-radius: 6px; background: #eef4f0; color: #1f2421; }
.ocf-table td.ocf-number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ocf-table tr.ocf-row-project td, .ocf-table tr.ocf-row-total td { background: #f3f1ea; font-weight: 700; }
.ocf-table tr.ocf-row-delivery td { background: #faf7f1; }
.ocf-table tr.ocf-row-retention td, .ocf-table tr.ocf-row-prepayment td { color: #6b6557; }
.ocf-dialog { width: min(1280px, 96vw); }
.ocf-dialog .ocf-result { max-height: 60vh; overflow: auto; }
.ocf-pane .finance-warnings { max-width: none; }

/* 月結歸月方式與截止日：只在每月彙總請款時顯示（po-field 的 display 不可蓋過 hidden）。 */
.oc-contract-fields [hidden], #ocMonthlyRule[hidden] { display: none !important; }
.ocf-form [hidden] { display: none !important; }
.ocf-table tr.ocf-row-voided td { color: #8a8478; text-decoration: line-through; }
.ocf-settlement { margin: 12px 0; padding: 8px 10px; border: 1px solid #e2ddd0; border-radius: 6px; }
.ocf-settlement h5 { margin: 0 0 6px; font-size: 1rem; }
.ocf-settlement .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.oc-documents-dialog .attachment-choice-box .checkline { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: auto; }
.oc-documents-dialog .attachment-choice-box .checkline input { flex: 0 0 auto; width: auto; margin: 0; }
