.pg-app { max-width:1480px; }
.pg-app [hidden] { display:none !important; }
.pg-header { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; padding:10px 0 22px; border-bottom:1px solid var(--line); }
.pg-header h1 { font-size:30px; line-height:1.3; }
.pg-nav,.pg-save-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.pg-nav { padding-top:6px; }
.pg-notice { margin:18px 0; padding:12px 16px; background:#fff4dd; color:#795316; border-left:4px solid var(--gold); border-radius:6px; }
.pg-load { margin:28px 0 14px; color:var(--muted); }
.pg-load[data-error="1"],.pg-form-error { color:#a83232; }
.pg-fields { margin:24px 0; padding:0; border:0; min-width:0; }
.pg-editor { display:grid; grid-template-columns:minmax(260px,0.8fr) minmax(420px,1.6fr); gap:18px; align-items:start; }
.pg-source-panel,.pg-gift-panel,.pg-rules-panel { padding:22px; min-width:0; }
.pg-app .panel-heading { display:flex; gap:12px; justify-content:space-between; align-items:center; margin-bottom:18px; }
.pg-source-empty { padding:22px 0; color:var(--muted); line-height:1.7; }
.pg-product { display:grid; gap:5px; min-width:0; }
.pg-code { font-family:Consolas,"Courier New",monospace; font-weight:700; font-size:16px; color:var(--teal-dark); overflow-wrap:anywhere; }
.pg-product strong { line-height:1.6; overflow-wrap:anywhere; }
.pg-style { color:var(--muted); line-height:1.5; overflow-wrap:anywhere; }
.pg-status { display:inline-flex; width:max-content; padding:3px 8px; border-radius:4px; font-size:12px; background:var(--surface-strong); color:var(--muted); }
.pg-status[data-tone="danger"] { background:#fce8e6; color:#a83232; }
.pg-status[data-tone="warning"] { background:#fff4dd; color:#795316; }
.pg-ratio { margin:22px 0; padding:15px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); color:var(--muted); line-height:1.7; }
.pg-ratio strong { color:var(--teal-dark); padding:0 4px; }
.pg-check { display:flex; align-items:center; gap:8px; line-height:1.6; }
.pg-check input { width:18px; height:18px; flex:0 0 auto; }
.pg-gift-rows { display:grid; gap:12px; }
.pg-gift-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:16px; align-items:center; padding:14px; border:1px solid var(--line); border-radius:8px; }
.pg-gift-row .pg-code { font-size:15px; }
.pg-gift-row .pg-check { font-size:14px; }
.pg-form-error { min-height:1.5em; margin-top:14px; line-height:1.6; }
.pg-save-row { margin-top:14px; padding-top:18px; border-top:1px solid var(--line); }
.pg-save-row .primary-link { border:0; }
.pg-app button:disabled { opacity:.5; cursor:default; }
.pg-rules-heading p { margin-top:6px; font-size:13px; }
.pg-filter-label { display:block; font-size:14px; font-weight:600; margin:12px 0 8px; }
.pg-app input[type="search"],.pg-picker input[type="search"] { display:block; width:100%; padding:12px 14px; border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--ink); font:inherit; }
.pg-app :focus-visible,.pg-picker :focus-visible { outline:3px solid #80c2bc; outline-offset:3px; }
.pg-rules { margin-top:18px; display:grid; }
.pg-rule { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:18px; padding:18px 0; border-top:1px solid var(--line); }
.pg-rule:first-child { border-top:0; }
.pg-rule-head { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:6px; }
.pg-rule-name { margin-bottom:6px; line-height:1.6; }
.pg-rule-gifts { color:var(--muted); font-size:14px; line-height:1.8; overflow-wrap:anywhere; }
.pg-rule-meta { color:var(--muted); font-size:12px; margin-top:8px; line-height:1.6; }
.pg-rule-actions { display:flex; flex-wrap:wrap; gap:8px; align-content:start; justify-content:flex-end; }
.pg-empty { color:var(--muted); padding:22px 0; line-height:1.7; }
.pg-picker { box-sizing:border-box; width:min(820px,calc(100vw - 28px)); max-height:90vh; max-height:90svh; padding:22px; border:1px solid var(--line); border-radius:12px; color:var(--ink); box-shadow:var(--shadow); }
.pg-picker::backdrop { background:rgba(24,32,29,.45); }
.pg-picker-header { display:flex; gap:18px; align-items:start; justify-content:space-between; }
.pg-picker-header p { margin-top:8px; font-size:14px; line-height:1.6; }
.pg-search-status { margin:14px 0; color:var(--muted); font-size:14px; line-height:1.5; }
.pg-search-results { display:grid; gap:8px; }
.pg-search-result { text-align:left; display:flex; align-items:start; gap:16px; justify-content:space-between; width:100%; background:#fff; border:1px solid var(--line); border-radius:7px; padding:14px; color:var(--ink); cursor:pointer; }
.pg-search-result:hover { background:var(--surface-strong); border-color:#80c2bc; }
.pg-search-result .pg-code { font-size:14px; }
.pg-search-result strong { display:block; margin:5px 0; }
.pg-entry { margin-top:12px; }
.pg-settings-link { display:inline-flex; align-items:center; padding:10px 14px; background:var(--surface); border:1px solid var(--line); border-radius:8px; color:var(--teal-dark); text-decoration:none; font-size:13px; font-weight:700; }
.pg-settings-link[hidden] { display:none; }
.pg-settings-link:focus-visible { outline:3px solid #80c2bc; outline-offset:3px; }
.pg-sr-only { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
body[data-purchase-gifts="1"] .site-dialog__table-wrap td { white-space:pre-wrap; overflow-wrap:anywhere; }
@media(max-width:800px) {
 .pg-header { flex-direction:column; gap:14px; }
 .pg-header h1 { font-size:26px; }
 .pg-editor { grid-template-columns:minmax(0,1fr); }
 .pg-source-panel,.pg-gift-panel,.pg-rules-panel { padding:17px; }
 .pg-gift-row { grid-template-columns:minmax(0,1fr) auto; gap:12px; }
 .pg-gift-row .pg-product { grid-column:1/-1; }
 .pg-rule { grid-template-columns:minmax(0,1fr); gap:12px; }
 .pg-rule-actions { justify-content:flex-start; }
 .pg-picker { padding:17px; }
 .pg-nav a,.pg-app button,.pg-picker button { min-height:42px; }
}



.pg-sources { display:grid; gap:10px; max-height:460px; overflow:auto; }
.pg-source-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:10px; padding:12px; border:1px solid var(--line); border-radius:7px; }
.pg-source-help { margin-top:12px; font-size:14px; line-height:1.7; }
.pg-picker [hidden] { display:none !important; }
.pg-picker .pg-search-results { max-height:42vh; max-height:42svh; overflow:auto; padding:2px; }
.pg-search-product { flex:1; min-width:0; overflow-wrap:anywhere; }
.pg-source-choice { align-items:flex-start; }
.pg-source-choice input[type="checkbox"] { width:18px; height:18px; flex:0 0 18px; margin:3px 0 0; accent-color:var(--teal-dark); }
.pg-source-choice:has(input:checked) { border-color:var(--teal); background:var(--surface-strong); }
.pg-source-choice:has(input:disabled) { cursor:default; }
.pg-source-choice > span:last-child { display:grid; gap:5px; }
.pg-picker-actions { margin-top:16px; padding-top:14px; border-top:1px solid var(--line); }
.pg-picker-count { margin:0 0 10px; font-weight:700; color:var(--teal-dark); font-size:14px; }
.pg-picked-sources { display:flex; flex-wrap:wrap; gap:6px; max-height:80px; overflow:auto; margin-bottom:12px; }
.pg-picker .pg-picker-chip { display:inline-flex; gap:8px; align-items:center; min-height:32px; padding:5px 9px; max-width:100%; border:1px solid var(--line); border-radius:5px; color:var(--teal-dark); background:var(--surface-strong); overflow-wrap:anywhere; text-align:left; }
.pg-picker-buttons { display:flex; flex-wrap:wrap; justify-content:space-between; gap:10px; }
@media(max-width:480px) {
 .pg-source-row { grid-template-columns:minmax(0,1fr); }
 .pg-source-row > button { justify-self:start; }
 .pg-picker-buttons > button { flex:1; }
 .pg-source-choice { gap:9px; padding:11px; }
 .pg-source-choice > span:last-child .pg-style { font-size:12px; }
}
