.mp-panel,.mp-dialog{--mp-blue:#204f79;--mp-line:#ccd8e4;--mp-ink:#163951;color:var(--mp-ink);font:15px/1.45 Arial,sans-serif;text-align:left}
.mp-dialog{box-sizing:border-box;padding:0;width:min(840px,94vw);max-height:90vh;background:white;border:1px solid var(--mp-line);border-radius:10px;overflow:auto;box-shadow:0 14px 45px #102a4440;position:fixed;inset:auto;margin:0;left:50%;transform:translateX(-50%);z-index:20000}
.mp-dialog::backdrop{background:#172a4055}
.mp-dialog>header,.mp-dialog>footer{display:flex;align-items:center;gap:12px;padding:16px 22px;background:#fff}
.mp-dialog>header{justify-content:space-between;border-bottom:1px solid var(--mp-line)}.mp-dialog h3{font:600 20px/1.3 Arial,sans-serif;margin:0;color:var(--mp-ink)}
.mp-dialog>footer{justify-content:center;border-top:1px solid var(--mp-line);background:#f5f7fa}.mp-dialog .mp-x{min-width:32px;border:0;color:#536879;background:none;font-size:22px;padding:2px}
.mp-body{padding:18px 22px}.mp-effect-grid{display:grid;grid-template-columns:minmax(152px,205px) minmax(0,1fr);gap:20px;align-items:start}.mp-effect-grid.mp-wide{grid-template-columns:1fr}
.mp-controls{display:grid;gap:16px;align-content:start}.mp-label{display:block;font-size:14px;color:#5e7488;margin:0 0 5px}.mp-dialog button,.mp-panel button{font:inherit;cursor:pointer}
.mp-action,.mp-dialog>footer button{border:1px solid var(--mp-blue);border-radius:5px;padding:7px 16px;min-height:36px;background:var(--mp-blue);color:#fff}
.mp-dialog>footer .mp-cancel{border-color:#c62e38;background:white;color:#b5202b}
.mp-select{position:relative;min-width:0}.mp-trigger{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;background:white;border:1px solid var(--mp-line);border-radius:5px;color:var(--mp-ink);min-height:38px;padding:6px 12px;text-align:left}
.mp-trigger:after{content:'';width:7px;height:7px;border:solid #476077;border-width:0 1.5px 1.5px 0;transform:rotate(45deg);margin:0 3px 4px}.mp-select [role=listbox]{position:absolute;z-index:10;top:calc(100% + 3px);left:0;min-width:100%;width:max-content;max-width:min(75vw,375px);max-height:200px;overflow:auto;padding:4px 0;background:white;color:var(--mp-ink);border:1px solid var(--mp-line);border-radius:5px;box-shadow:0 5px 15px #13354e24}
.mp-select [role=option]{padding:7px 12px;display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer}.mp-select [aria-selected=true]{color:var(--mp-blue);font-weight:600}.mp-select [aria-selected=true]:after{content:'✓'}.mp-select [role=option]:hover,.mp-select [role=option]:focus{background:#eaf2f7;outline:none}.mp-select input[type=search]{box-sizing:border-box;display:block;width:calc(100% - 12px);margin:4px 6px 7px;padding:6px;border:1px solid var(--mp-line);font:inherit}
.mp-scroll{display:flex;gap:12px;align-items:end;flex-wrap:wrap}.mp-scroll>.mp-field{flex:1 1 200px;max-width:460px}.mp-readback{display:flex;align-items:center;gap:8px;margin:10px 0;color:#496278;overflow-wrap:anywhere}.mp-chip{display:inline-block;width:28px;height:20px;border:1px solid #a7bac9;border-radius:3px}.mp-preview{display:grid;place-items:center;border:1px solid #dae2ea;background:#f6f8fb;border-radius:6px;min-height:245px;overflow:hidden}.mp-preview canvas{width:100%;max-height:400px;object-fit:contain;display:block}
.mp-dialog input[type=color]{box-sizing:border-box;width:100%;height:34px;padding:2px;background:#fff;border:1px solid var(--mp-line);border-radius:5px}.mp-swatches{display:flex;gap:6px;margin-top:6px}.mp-swatches label{flex:1}
.mp-dialog [role=tablist]{display:flex;border-bottom:1px solid var(--mp-line);margin-bottom:14px}.mp-dialog [role=tab]{background:transparent;border:0;border-bottom:2px solid transparent;padding:8px 12px;color:var(--mp-ink)}.mp-dialog [role=tab][aria-selected=true]{border-color:var(--mp-blue);color:var(--mp-blue);font-weight:600}.mp-error{color:#ae232c;margin-top:8px}.mp-dialog button:disabled,.mp-panel button:disabled{opacity:.5;cursor:default}
@media(max-width:560px){.mp-effect-grid{grid-template-columns:1fr}.mp-preview{min-height:180px}.mp-body{padding:12px}}
.mp-config-section{--mp-blue:#204f79;margin:16px 0;padding:16px 20px;border:1px solid #d5dfe8;border-radius:6px;background:#fff}.mp-config-section h3{margin:0 0 12px;color:#173b5b;font-size:16px}.mp-action{background:#204f79;color:#fff}
.mp-panel{display:flex;flex-direction:column;align-items:stretch;gap:10px}
.mp-panel .mp-scroll{display:block}.mp-panel .mp-scroll>.mp-field{max-width:none}
.mp-panel .mp-preview-actions{display:flex;justify-content:flex-start}
.mp-panel .mp-trigger,.mp-controls .mp-trigger,.mp-controls .mp-swatches input[type=color]{box-sizing:border-box;width:100%;height:40px;min-height:40px;margin:0}
.mp-controls .mp-swatches{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
.mp-controls .mp-swatches label{display:block;width:100%;min-width:0}
.mp-result{min-width:0}.mp-customer-colors{border:0;padding:0;margin:12px 0 0;min-width:0}
.mp-customer-colors legend{padding:0;margin:0 0 6px;color:#5e7488;font-size:14px}
.mp-color-list{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:2px}
.mp-color-list .mp-customer-chip,.mp-color-list .mp-global-swatch{position:relative;display:inline-block;flex:none;box-sizing:border-box;width:32px;height:32px;min-width:32px;min-height:32px;padding:0;margin:0;border:1px solid #a5b7c9;border-radius:5px;cursor:pointer}
.mp-customer-chip[aria-pressed=true],.mp-customer-chip:focus-visible,.mp-global-swatch:focus-within{outline:2px solid #204f79;outline-offset:2px}
.mp-global-swatch{background:linear-gradient(115deg,#de5665,#f1ae48,#bdda64,#49bcb0,#5782ce,#a467bd)}
.mp-dialog .mp-global-swatch input[type=color]{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}

/* Match the standard dialog placeholder, including menus mounted on document.body. */
@layer filter-picker-placeholder {
  .mp-select input[type="search"]::placeholder,
  #admin-select-menu[data-filter-pack] input[type="search"]::placeholder,
  .mp-select .mp-trigger[data-empty],
  .admin-select-control:has(select[data-pack-search="true"] option[value=""]:checked) .admin-select-label {
    font-family:var(--font-body, Arial, sans-serif) !important;
    font-size:14px !important;
    font-weight:400 !important;
    font-style:normal !important;
    color:#9ca3af !important;
    opacity:1 !important;
  }
}

.ed-mode,.ed-single{display:flex;align-items:end;flex-wrap:wrap;gap:12px;margin-bottom:12px}
.ed-mode>.mp-field{width:min(212px,100%)}.ed-single>.mp-field,.ed-single>.ed-color{width:min(210px,100%)}
.ed-setup .mp-action,.ed-preview .mp-action{background:#204f79;color:white;border:1px solid #204f79;border-radius:5px;min-height:38px;padding:6px 16px}
.ed-setup .mp-action:disabled,.ed-setup .ed-delete:disabled{opacity:.42;cursor:default}
.ed-setup .ed-mode .mp-label{display:flex;align-items:center;gap:6px}
.ed-setup .ed-help{display:inline-grid;place-items:center;box-sizing:border-box;min-width:16px;width:16px;height:16px;min-height:16px;padding:0;border:1px solid #86a6be;color:#204f79;border-radius:50%;font:600 11px/1 Arial,sans-serif;background:#fff}
.ed-tip{position:fixed;inset:auto;margin:0;width:min(300px,calc(100vw - 24px));box-sizing:border-box;padding:10px 12px;border:1px solid #c7d6e4;border-radius:6px;box-shadow:0 4px 16px #173a5826;background:white;color:#24435e;font:14px/1.45 Arial,sans-serif;pointer-events:none}
.ed-row{display:grid;grid-template-columns:30px minmax(92px,145px) minmax(166px,1fr) auto;align-items:end;gap:8px;margin:10px 0}
.ed-row>*,.ed-render>.mp-field{min-width:0}.ed-row .ed-name,.ed-setup .mp-trigger,.ed-preview .mp-trigger{box-sizing:border-box;min-width:0;width:100%;height:38px}
.ed-row .ed-name{border:1px solid #c9d7e5;border-radius:5px;padding:6px 10px;color:inherit;font:inherit}
.ed-row .ed-grip,.ed-row .ed-delete{height:38px;min-width:0;padding:0 8px;border:1px solid #c9d7e5;border-radius:5px;background:white;color:#204f79}.ed-row .ed-grip{cursor:grab}.ed-row .ed-delete,.ed-setup>footer .ed-cancel,.ed-preview>footer .ed-cancel{color:#bf2d35;background:white;border:1px solid #bd3a41}
.ed-row .ed-render{display:flex;align-items:end;gap:4px}.ed-render>.mp-field{flex:1}.ed-render input[type=color]{width:30px;height:38px;padding:2px}
.ed-setup .ed-add{margin-top:6px}.ed-error{color:#bb252e}

.ed-setup [role=option][hidden],.ed-preview [role=option][hidden]{display:none!important}

.ed-tabs{display:flex;flex-wrap:wrap;gap:4px;border-bottom:1px solid #c9d7e5;margin-bottom:14px}
.ed-preview .ed-tabs button{padding:8px 16px;min-width:0;min-height:36px;background:white;border:1px solid #c9d7e5;border-radius:5px 5px 0 0;color:#204f79}
.ed-preview .ed-tabs button[aria-selected=true]{background:#204f79;color:#fff;border-color:#204f79}
.ed-preview-panel.ed-with-controls{display:grid;grid-template-columns:minmax(142px,180px) minmax(0,1fr);gap:16px}
.ed-art{display:grid;place-items:center;min-height:220px;border:1px solid #d4dfe7;border-radius:6px;background:repeating-conic-gradient(#edf1f4 0 25%,white 0 50%) 0 0/20px 20px}
.ed-logo{width:64%;max-width:340px;mask-size:contain;mask-position:center;mask-repeat:no-repeat;filter:var(--ed-filter,none)}.ed-logo img{display:block;width:100%;height:auto}
.ed-custom-color{margin-top:6px}.ed-color [hidden]{display:none}
@media(max-width:640px){.ed-row{grid-template-columns:28px minmax(82px,1fr) minmax(110px,1.5fr)}.ed-render{grid-column:2}.ed-delete{justify-self:start}.ed-preview-panel.ed-with-controls{grid-template-columns:minmax(108px,32%) minmax(0,1fr);gap:8px}.ed-art{min-height:160px}}

/* The embedded stage supplies high-priority generic button rules. Allocate
   the editor controls' semantics to a named layer so they win that cascade. */
@layer editorFilterControls {
  dialog.ed-setup button.mp-action,dialog.ed-preview button.mp-action,
  dialog.ed-preview .ed-tabs button[aria-selected=true] {
    background:#204f79!important;color:#fff!important;border:1px solid #204f79!important;
  }
  dialog.ed-setup button.ed-help {
    display:inline-grid!important;place-items:center!important;box-sizing:border-box!important;
    width:16px!important;min-width:16px!important;max-width:16px!important;
    height:16px!important;min-height:16px!important;max-height:16px!important;
    margin:0!important;padding:0!important;line-height:1!important;font:600 11px/1 Arial,sans-serif!important;
    border:1px solid #86a6be!important;background:#fff!important;color:#204f79!important;border-radius:50%!important;
  }
  dialog.ed-setup button.ed-cancel,dialog.ed-preview button.ed-cancel {background:white!important;color:#bd3038!important;border-color:#bd3038!important}
}

@layer filterPalette {
 .mp-result>.mp-customer-colors {
   box-sizing:border-box!important;width:100%!important;min-width:0!important;
   margin:12px 0 0!important;padding:12px 14px!important;
   border:1px solid #d5dfe8!important;border-radius:6px!important;background:#fff!important;
 }
 .mp-result .mp-color-list {display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:0}
 .mp-result .mp-color-list :is(.mp-customer-chip,.mp-global-swatch) {
   box-sizing:border-box!important;display:inline-block!important;flex:0 0 32px!important;
   width:32px!important;min-width:32px!important;max-width:32px!important;
   height:32px!important;min-height:32px!important;max-height:32px!important;
   padding:0!important;margin:0!important;border-radius:3px!important;
 }
 .mp-result .mp-customer-chip[aria-pressed=true],.mp-result .mp-color-list :focus-visible,
 .mp-result .mp-global-swatch:focus-within{outline:2px solid #204f79!important;outline-offset:2px!important}
}

.mp-select [role=listbox].mp-floating-packs {position:fixed;inset:auto;margin:0;min-width:0;max-width:none;box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain}
.mp-select .mp-floating-packs input[type=search] {position:sticky;top:0;z-index:1;background-color:white}
.mp-select .mp-floating-packs [role=option][hidden] {display:none}
#mp-filter-hex{position:fixed;z-index:4500;box-sizing:border-box;width:282px;max-width:calc(100vw - 16px);padding:6px;border:1px solid #e4e7ed;border-radius:4px;background:#fff;box-shadow:0 2px 12px #0000001a;color:#1f4e79;font:14px Arial,sans-serif}
#mp-filter-hex[hidden]{display:none}
.mp-hsv-main{display:flex;gap:8px;margin-bottom:6px}
.mp-hsv-sv{position:relative;flex:1;height:180px;min-width:0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent);touch-action:none;cursor:crosshair}
.mp-hsv-sv i{position:absolute;width:5px;height:5px;border:1px solid #fff;border-radius:50%;box-shadow:0 0 1px 1px #0006;transform:translate(-50%,-50%);pointer-events:none}
.mp-hsv-hue{position:relative;width:12px;margin:0 3px;height:180px;flex:none;background:linear-gradient(to bottom,#f00 0%,#ff0 16.67%,#0f0 33.33%,#0ff 50%,#00f 66.67%,#f0f 83.33%,#f00);touch-action:none;cursor:ns-resize}
.mp-hsv-hue i{position:absolute;left:-3px;width:18px;height:4px;box-sizing:border-box;background:white;border:1px solid #ddd;border-radius:1px;box-shadow:0 0 2px #0009;transform:translateY(-50%);pointer-events:none}
.mp-hsv-footer{display:flex;align-items:center;gap:7px;padding-top:6px}
#mp-filter-hex input{box-sizing:border-box;width:116px;min-width:0;height:32px;padding:0 8px;border:1px solid #dcdfe6;border-radius:4px;background:white;color:#1f4e79;font:13px Arial,sans-serif}
#mp-filter-hex button{height:32px;min-height:32px;padding:0 12px;background:white;border:1px solid #dcdfe6;border-radius:4px;color:#1f4e79;font:600 13px Arial,sans-serif;cursor:pointer}
#mp-filter-hex [data-picker-clear]{border-color:transparent;margin-left:auto;padding:0 4px}
#mp-filter-hex button:hover{border-color:#1f4e79;background:#f4f7fa}
#mp-filter-hex :focus-visible{outline:2px solid #1f4e79;outline-offset:2px}
#mp-filter-hex p{font-size:12px;color:#a32b2b;margin:6px 0 2px}
/* Match the middle-office variable colour popup and gradient action colours. */
html body #mp-filter-hex{width:320px;padding:14px;border:1px solid #ccdbe7;border-radius:10px;box-shadow:0 8px 28px #193f6124;z-index:4500;}
html body #mp-filter-hex .mp-hsv-main{gap:12px;margin-bottom:14px;}
html body #mp-filter-hex .mp-hsv-hue{width:14px;margin:0;}
html body #mp-filter-hex .mp-hsv-footer{gap:8px;padding:0;}
html body #mp-filter-hex input{width:100px;flex:0 0 100px;height:36px;padding:0 10px;font:400 14px 'DIN UI','Inter UI',sans-serif;text-align:left;}
html body #mp-filter-hex button{display:inline-flex;align-items:center;justify-content:center;height:36px;min-height:36px;line-height:1;margin:0;padding:0 10px;font:600 16px 'Gemunu Libre UI',sans-serif;border-radius:4px;}
html body #mp-filter-hex [data-picker-clear]{min-width:48px;color:#587089;background:transparent;border-color:transparent;}
html body #mp-filter-hex [data-picker-confirm]{min-width:80px;margin-left:auto;background:#1f4e79;color:#fff;border:1px solid #87a7c3;}
html body #mp-filter-hex [data-picker-confirm]:hover{background:#3375a4;border-color:#3375a4;}

#mp-filter-hex {inset:auto;margin:0;overflow:auto;overscroll-behavior:contain}
.mp-dialog button.mp-hex-trigger,.ed-setup button.mp-hex-trigger,.ed-preview button.mp-hex-trigger {
 box-sizing:border-box;width:100%;height:40px;min-width:32px;padding:4px;
 border:1px solid #cbd9e5;border-radius:5px;background:white;cursor:pointer;
}
button.mp-hex-trigger::before {content:'';display:block;width:100%;height:100%;border-radius:2px;background:var(--mp-swatch)}
.mp-global-swatch button.mp-hex-trigger {position:absolute;inset:0;opacity:0}
.mp-dialog .mp-hex-trigger[hidden] {display:none!important}

dialog .mp-panel .mp-scroll {width:320px;max-width:100%;min-width:0;box-sizing:border-box}
dialog .mp-panel .mp-scroll>.mp-field,dialog .mp-panel .mp-scroll .mp-select {display:block;width:100%;min-width:0;max-width:100%;box-sizing:border-box}
dialog .mp-panel .mp-scroll .mp-select>.mp-trigger {width:100%;max-width:100%;box-sizing:border-box}

@layer editorFilterControls {
 dialog .mp-select [role=listbox].mp-floating-packs {overflow-x:hidden!important}
 dialog .mp-select .mp-floating-packs input[type=search] {
  box-sizing:border-box!important;min-width:0!important;width:calc(100% - 12px)!important;
  max-width:calc(100% - 12px)!important;margin-inline:6px!important
 }
 dialog .mp-select .mp-floating-packs [role=option] {
  box-sizing:border-box!important;max-width:100%;white-space:normal!important;overflow-wrap:anywhere
 }
 dialog.ed-setup .ed-mode {align-items:flex-end!important}
}

@layer editorFilterControls {
  .mp-preview-actions>button.mp-action:enabled, .ed-mode>button.mp-action,
  button.aw-btn:is([aria-label="View effect"],[aria-label="查看效果"]) {
    background:#204f79!important;
    border-color:#204f79!important;
    color:#fff!important;
    opacity:1!important;
  }
  :is(.mp-preview-actions,.ed-mode)>button.mp-action:disabled,
  button.aw-btn:is([aria-label="View effect"],[aria-label="查看效果"]):disabled {
    cursor:not-allowed!important;
  }
}

@layer editorFilterControls {
  dialog:is(.mp-dialog,.af-dialog) > footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px !important;
  }
  dialog:is(.mp-dialog,.af-dialog) > footer > button {
    box-sizing: border-box !important;
    min-width: 92px !important;
    min-height: 34px !important;
    padding: 6px 16px !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 20px !important;
    border-radius: 5px !important;
    border: 1px solid #204f79 !important;
    color: white !important;
    background: #204f79 !important;
  }
  dialog:is(.mp-dialog,.af-dialog) > footer > button:is(.mp-cancel,.ed-cancel,.af-cancel) {
    border-color: #bd3038 !important;
    color: #bd3038 !important;
    background: white !important;
  }
  dialog:is(.mp-dialog,.af-dialog) > footer > button:disabled {
    opacity: .45 !important;
    cursor: not-allowed !important;
  }
}

@layer editorFilterControls {
  .mp-preview-actions > button.mp-action:disabled {
    background: #f5f7fa !important;
    border-color: #dcdfe6 !important;
    color: #909399 !important;
    opacity: 1 !important;
    cursor: not-allowed !important;
  }
}

@layer editorFilterControls {
  dialog.mp-dialog .mf-controls button.mf-chip { --control-size: 32px; }
  dialog.mp-dialog .mf-controls button.mf-help {
    --control-size: 17px;
    display: inline-grid !important;
    place-items: center;
    border-radius: 50% !important;
    line-height: 1 !important;
  }
  dialog.mp-dialog .mf-controls button:is(.mf-chip, .mf-help) {
    box-sizing: border-box;
    width: var(--control-size) !important;
    height: var(--control-size) !important;
    min-width: var(--control-size) !important;
    max-width: var(--control-size) !important;
    min-height: var(--control-size) !important;
    max-height: var(--control-size) !important;
    flex: none;
    padding: 0 !important;
  }
}

@layer editorFilterControls {
  dialog.mp-dialog .mf-layout > .mf-controls,
  dialog.ed-preview .ed-preview-panel > .mp-controls {
    display: flex !important;
    flex-direction: column !important;
    align-self: start !important;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px !important;
    height: auto !important;
    min-height: 0 !important;
  }
  dialog.mp-dialog .mf-controls > .mf-box {
    display: grid !important;
    grid-template-rows: auto auto;
    align-content: start;
    gap: 6px !important;
    padding: 8px !important;
    flex: none;
  }
  dialog.mp-dialog .mf-controls :is(.mf-box, .mf-title, .mf-options),
  dialog.ed-preview .mp-controls .mp-field {
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }
  dialog.mp-dialog .mf-controls .mf-title {
    line-height: 18px !important;
    padding: 0;
  }
  dialog.mp-dialog .mf-controls .mf-options {
    gap: 6px 5px !important;
    align-content: start;
    padding: 0;
  }
  dialog.mp-dialog .mf-options > .mp-label { margin: 0; line-height: 18px; }
  dialog.ed-preview .mp-controls :is(.mp-trigger, input[type=color]) {
    box-sizing: border-box;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
  }
}
