.pf-modal-open { overflow: hidden; }
.pf-modal-open .swal2-container { z-index: 9100 !important; }
.pf-shell[hidden] { display: none !important; }
.pf-shell { position: fixed; inset: 0; z-index: 9000; }
.pf-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .72); }
.pf-dialog { position: absolute; inset: 3vh 3vw; display: flex; flex-direction: column; max-width: 1500px; margin: auto; background: #fff; border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,.35); overflow: hidden; }
.pf-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 20px; color: #fff; background: #24364b; }
.pf-header h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; }
.pf-header p { margin: 0; color: #d9e2ec; overflow-wrap: anywhere; }
.pf-icon-button { flex: 0 0 auto; border: 0; background: transparent; color: inherit; font-size: 30px; line-height: 1; cursor: pointer; }
.pf-icon-button:focus, .pf-result:focus, .pf-dialog button:focus, .pf-dialog input:focus, .pf-dialog textarea:focus { outline: 3px solid #72b7ff; outline-offset: 2px; }
.pf-alert { margin: 12px 20px 0; padding: 10px 12px; border: 1px solid #b42318; border-radius: 4px; background: #fef3f2; color: #7a271a; }
.pf-alert.is-warning { border-color: #dc8b09; background: #fff8e6; color: #6b4100; }
.pf-alert.is-success { border-color: #2f855a; background: #edfdf3; color: #1c6442; }
.pf-conflict { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; padding: 11px; border: 2px solid #b42318; border-radius: 4px; background: #fef3f2; color: #7a271a; }
.pf-conflict.is-open { border-color: #dc8b09; background: #fff8e6; color: #6b4100; }
.pf-conflict .btn { align-self: flex-start; margin-top: 4px; }
.pf-conflict-dialog { text-align: left; }
.pf-conflict-dialog label { display: block; margin: 8px 0 3px; font-weight: 700; }
.pf-conflict-dialog .swal2-input, .pf-conflict-dialog .swal2-textarea { box-sizing: border-box; width: 100%; margin: 0; }
.pf-conflict-dialog .pf-conflict-ack { display: flex; gap: 7px; align-items: flex-start; font-weight: 600; }
.pf-summary { display: grid; grid-template-columns: repeat(5, minmax(100px, 1fr)); gap: 8px; padding: 12px 20px; background: #eef3f8; border-bottom: 1px solid #d6dee8; }
.pf-summary div { min-width: 0; padding: 8px; background: #fff; border-radius: 4px; text-align: center; }
.pf-summary strong { display: block; font-size: 19px; }
.pf-summary span { display: block; font-size: 11px; color: #4b5563; }
.pf-summary .pf-summary-audit { border: 1px solid #9fb3c8; background: #f8fbff; }
.pf-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 20px 90px; background: #f7f9fc; }
.pf-loading, .pf-empty { padding: 30px; text-align: center; color: #52606d; }
.pf-line { margin-bottom: 14px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; overflow: hidden; }
.pf-line-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #d9e2ec; background: #f8fafc; }
.pf-line-heading strong, .pf-line-heading span { display: block; }
.pf-line-heading > div > span { margin-top: 2px; color: #52606d; overflow-wrap: anywhere; }
.pf-line-heading .pf-lot-label { display: inline; color: #52606d; font-weight: 600; }
.pf-line-heading .pf-lot-number { display: inline; margin-left: 2px; color: #24364b; font-size: 16px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; word-break: break-word; }
.pf-status { flex: 0 0 auto; padding: 4px 8px; border: 1px solid #64748b; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pf-compare { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(520px, 2fr); }
.pf-plan, .pf-actual { min-width: 0; padding: 12px; }
.pf-plan { border-right: 1px solid #d9e2ec; background: #fbfdff; }
.pf-plan h4, .pf-actual h4 { margin: 0 0 10px; color: #334e68; font-size: 12px; letter-spacing: .05em; }
.pf-plan dl { display: grid; grid-template-columns: minmax(105px, .8fr) minmax(120px, 1.3fr); gap: 5px 10px; margin: 0; }
.pf-plan dt { color: #52606d; font-size: 11px; }
.pf-plan dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pf-plan small, .pf-actual small { display: block; color: #66788a; font-weight: 400; overflow-wrap: anywhere; }
.pf-unknown { color: #9a3412; }
.pf-review-check { display: block; margin-top: 12px; padding: 8px; border: 1px solid #f59e0b; background: #fffbeb; font-weight: 600; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pf-table-scroll { width: 100%; overflow-x: auto; }
.pf-table-scroll table { min-width: 650px; margin-bottom: 6px; }
.pf-table-scroll td { vertical-align: middle; overflow-wrap: anywhere; }
.pf-table-scroll tr.is-changed td { background: #fff8e6; }
.pf-table-scroll tr.is-over-available td { background: #fef3f2; }
.pf-location-value { display: block; min-width: 100px; font-weight: 600; }
.pf-qty { width: 95px; margin: 0 !important; }
.pf-qty.is-error { border-color: #b42318 !important; box-shadow: 0 0 0 2px rgba(180,35,24,.12); }
.pf-availability { display: block; margin-top: 3px; color: #52606d; font-size: 10px; white-space: nowrap; }
.pf-chip { display: inline-block; padding: 2px 6px; border-radius: 999px; border: 1px solid; font-size: 10px; font-weight: 700; }
.pf-chip.is-ok { border-color: #16794c; color: #11643f; background: #ecfdf3; }
.pf-chip.is-warning { border-color: #b45309; color: #92400e; background: #fffbeb; }
.pf-chip.is-error { border-color: #b42318; color: #912018; background: #fef3f2; }
.pf-total { margin: 6px 0 0; text-align: right; font-weight: 700; }
.pf-total.is-error { color: #b42318; }
.pf-display-comparison { margin-bottom: 16px; border: 2px solid #627d98; border-radius: 6px; background: #fff; overflow: hidden; }
.pf-display-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; background: #eaf1f8; }
.pf-display-heading strong, .pf-display-heading small { display: block; }
.pf-display-heading small { margin-top: 2px; color: #52606d; }
.pf-display-totals { display: flex; flex-wrap: wrap; gap: 12px; }
.pf-display-totals span { white-space: nowrap; }
.pf-display-totals strong { display: inline; margin-left: 3px; }
.pf-display-table-scroll { width: 100%; overflow-x: auto; }
.pf-display-table { min-width: 650px; margin: 0; }
.pf-display-table th { width: 42%; background: #f8fafc; color: #334e68; font-size: 12px; letter-spacing: .04em; }
.pf-display-table th:last-child { width: 16%; }
.pf-display-table td { vertical-align: middle; }
.pf-display-table td > strong, .pf-display-table td > span, .pf-display-table td > small { display: block; }
.pf-display-table td > small { margin-bottom: 4px; color: #66788a; }
.pf-display-empty { color: #829ab1; font-size: 18px; }
.pf-actual-controls { background: #fff; }
.pf-reason { position: sticky; top: -14px; z-index: 2; margin: -2px 0 12px; padding: 10px; border: 1px solid #b45309; background: #fff8e6; }
.pf-reason label { display: block; font-weight: 700; }
.pf-reason textarea { box-sizing: border-box; width: 100%; resize: vertical; }
.pf-selector { position: absolute; z-index: 4; top: 70px; right: 0; bottom: 66px; width: min(520px, 92vw); box-sizing: border-box; padding: 14px; background: #fff; border-left: 1px solid #bcccdc; box-shadow: -12px 0 30px rgba(15, 23, 42, .22); overflow-y: auto; }
.pf-selector[hidden] { display: none; }
.pf-selector-head { display: flex; justify-content: space-between; align-items: center; color: #24364b; }
.pf-selector-head h3 { margin: 0; }
.pf-search-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 12px 0; }
.pf-search-row label { grid-column: 1 / -1; font-weight: 700; }
.pf-search-row input { min-width: 0; margin: 0; }
.pf-selector-results { display: grid; gap: 7px; }
.pf-result { display: block; width: 100%; padding: 10px; border: 1px solid #bcccdc; border-radius: 4px; background: #fff; color: #102a43; text-align: left; cursor: pointer; }
.pf-result:hover { border-color: #2680c2; background: #eef8ff; }
.pf-result.is-insufficient { border-color: #dc8b09; background: #fff8e6; }
.pf-result:disabled { cursor: not-allowed; opacity: .55; background: #eef2f6; border-color: #cbd2d9; }
.pf-result strong, .pf-result span { display: block; overflow-wrap: anywhere; }
.pf-result span { margin-top: 3px; color: #52606d; font-size: 11px; }
.pf-selector-pages { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.pf-footer { position: absolute; z-index: 3; right: 0; bottom: 0; left: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #bcccdc; background: #fff; box-shadow: 0 -6px 18px rgba(15, 23, 42, .08); }
@media (max-width: 900px) {
  .pf-dialog { inset: 1vh 1vw; }
  .pf-summary { grid-template-columns: repeat(3, 1fr); }
  .pf-compare { grid-template-columns: 1fr; }
  .pf-plan { border-right: 0; border-bottom: 1px solid #d9e2ec; }
  .pf-footer { flex-wrap: wrap; }
  .pf-display-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .pf-header, .pf-body, .pf-footer { padding-left: 10px; padding-right: 10px; }
  .pf-summary { grid-template-columns: repeat(2, 1fr); padding: 8px 10px; }
  .pf-line-heading .pf-lot-number { font-size: 14px; }
  .pf-plan dl { grid-template-columns: 1fr; }
  .pf-footer .btn { flex: 1 1 45%; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { .pf-shell * { scroll-behavior: auto !important; } }
