/* The editor shares the existing control panel's graphite and orange palette. */
.shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; align-items:stretch; }
.shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) .plan-list { grid-column:1 / -1; }
.shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) .profile-picker { min-width:0; display:contents; }
.shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) .profile-select-shell { min-width:0; width:100%; }
.shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) .profile-picker::after { display:none; }
.shell .hero-settings:not(:has(#profilePickerButton[data-selector="profile"])) .edit-plan-entry { display:none; }
.shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) #profilePickerLabel { grid-column:1;grid-row:2; }
.shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) .profile-select-shell { grid-column:1;grid-row:3; }
.edit-plan-entry { grid-column:2;grid-row:3;display:flex; align-items:center; justify-content:center; gap:7px; border:1px solid var(--graphite); background:var(--surface); color:var(--graphite); font:600 14px inherit; font-family:inherit; border-radius:4px; min-height:44px; cursor:pointer; }
.edit-plan-entry:hover { background:#edf2f5; }
@media (max-width:820px) {
 body[data-mobile-view] .shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) { grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px; }
 body[data-mobile-view] .shell .edit-plan-entry { min-height:38px; font-size:calc(13px * var(--mobile-button-factor,1)); }
 body[data-mobile-view] .shell .hero-settings:has(#profilePickerButton[data-selector="profile"]) .plan-list { margin:0; }
}
.pe-dialog{--pe-ink:#24323d;--pe-muted:#667580;--pe-line:#dce2e7;--pe-soft:#f3f5f7;border:1px solid var(--pe-line);border-radius:12px;padding:0;color:var(--pe-ink);background:#fff;font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;box-shadow:0 20px 70px #182a3b33}
.pe-dialog::backdrop{background:#1b2c3b66}.pe-dialog button,.pe-dialog input{font-family:inherit}.pe-dialog button{font-size:14px;font-weight:500;cursor:pointer}.pe-dialog button:disabled{color:#9aa3aa;background:#f3f5f7;border-color:#e4e8ec;cursor:default;pointer-events:none}.pe-dialog svg{width:18px;height:18px;flex-shrink:0}.pe-dialog :focus-visible{outline:2px solid #33759f;outline-offset:2px}
.pe-main{width:min(680px,calc(100vw - 48px));height:min(760px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);overflow:hidden}.pe-main[open]{display:flex;flex-direction:column}.pe-header{height:64px;min-height:64px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 20px;border-bottom:1px solid var(--pe-line)}.pe-heading h2{font-size:18px;line-height:24px;font-weight:650}.pe-heading p{display:none}
.pe-icon{width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--pe-line);border-radius:6px;background:#fff;color:var(--pe-ink);flex-shrink:0}.pe-close{border:0;background:transparent}
@media (hover:hover) and (pointer:fine){.pe-icon:hover,.pe-button:hover,.pe-row-tool:hover{background:var(--pe-soft)}}
.pe-config{padding:14px 20px;background:#fff;border-bottom:1px solid var(--pe-line);flex-shrink:0;position:relative;z-index:3}.pe-label{display:block;font-size:12px;font-weight:500;color:var(--pe-muted);margin:0 0 6px}.pe-config-controls{display:flex;align-items:center;gap:8px}.pe-button{min-height:44px;padding:0 12px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--pe-line);border-radius:6px;color:var(--pe-ink);background:#fff;white-space:nowrap}.pe-primary{background:#344958;border-color:#344958;color:#fff}.pe-primary:hover{background:#293d4b}.pe-danger{color:#b94b47}.pe-danger-fill{background:#b94b47;border-color:#b94b47;color:#fff}.pe-danger-fill:hover{background:#a7403c}.pe-more-wrap{position:relative}.pe-menu{position:absolute;right:0;top:50px;width:186px;padding:4px;background:#fff;border:1px solid var(--pe-line);border-radius:8px;box-shadow:0 8px 24px #24323d22}.pe-menu button{width:100%;height:44px;display:flex;align-items:center;gap:10px;padding:0 12px;border:0;border-radius:4px;background:#fff;text-align:left}.pe-menu button:hover{background:var(--pe-soft)}.pe-menu .pe-danger{color:#b94b47}
.pe-scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 20px 16px;background:#fff;scrollbar-width:thin}.pe-list-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 0 10px}.pe-list-heading h3{font-size:13px;font-weight:600}.pe-list-heading h3 span{font-size:12px;color:var(--pe-muted);font-weight:400;margin-left:6px;font-variant-numeric:tabular-nums}.pe-list-heading p{font-size:12px;color:var(--pe-muted)}
.pe-columns{display:grid;grid-template-columns:24px minmax(0,1fr) 76px 44px;gap:8px;font-size:12px;color:var(--pe-muted);padding:0 0 8px;border-bottom:1px solid var(--pe-line)}.pe-columns span:nth-child(3){text-align:center}.pe-row{display:grid;grid-template-columns:24px minmax(0,1fr) 76px 44px;gap:0 8px;align-items:center;border-bottom:1px solid #e9edf0;padding:8px 0}.pe-order{font-size:13px;color:var(--pe-muted);font-variant-numeric:tabular-nums}.pe-field-label{display:none}.pe-hero-field,.pe-level-field{min-width:0}.pe-hero-button{height:44px;width:100%;display:flex;align-items:center;justify-content:space-between;gap:4px;border:1px solid var(--pe-line);border-radius:6px;padding:0 10px;background:#fff;min-width:0}.pe-dialog .pe-hero-button{font-size:16px;font-weight:400}.pe-hero-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pe-hero-button svg{width:14px;height:14px;color:var(--pe-muted)}.pe-level-box{height:44px;display:flex;align-items:center;border:1px solid var(--pe-line);border-radius:6px;background:#fff;overflow:hidden}.pe-level-box input{width:100%;min-width:0;height:42px;padding:0 6px;text-align:center;font-size:16px;font-variant-numeric:tabular-nums;font-weight:400;border:0;background:transparent;outline:0;color:var(--pe-ink)}.pe-level-box span{display:none}.pe-level-box:focus-within{outline:2px solid #33759f;outline-offset:1px}.pe-level-box:has(input[aria-invalid=true]){outline:2px solid #b94b47}.pe-row-tool{height:44px;min-width:44px;display:flex;align-items:center;justify-content:center;gap:4px;border:1px solid var(--pe-line);border-radius:6px;padding:0 10px;background:#fff}.pe-row-tool.pe-remove{color:#b94b47}
.pe-footer{flex-shrink:0;border-top:1px solid var(--pe-line);padding:8px 20px 12px;background:#fff}.pe-save-status{font-size:12px;color:var(--pe-muted);margin-bottom:6px;line-height:18px}.pe-save-status.is-dirty{color:#ac4c29}.pe-empty{padding:36px 12px;text-align:center}.pe-empty>svg{width:28px;height:28px;margin-bottom:12px;color:#8595a0}.pe-empty h3{font-size:16px;margin-bottom:6px}.pe-empty p{font-size:13px;color:var(--pe-muted);line-height:1.8}.pe-notice{flex-shrink:0;padding:8px 20px;font-size:12px;background:#fff4e2;color:#8c651c;border-bottom:1px solid #f1e0c4}.pe-error{padding:10px 12px;margin-top:12px;font-size:13px;border-radius:6px;color:#b1443d;background:#fff0ee}
.pe-small{width:min(380px,calc(100vw - 32px));max-height:calc(var(--remote-viewport-height,100dvh) - 32px);padding:20px;overflow:auto}.pe-small h2{font-size:18px;margin-bottom:10px}.pe-small p{font-size:14px;color:var(--pe-muted);line-height:1.7;margin-bottom:16px;overflow-wrap:anywhere}.pe-small input{height:44px;width:100%;padding:0 10px;border:1px solid var(--pe-line);border-radius:6px;font-size:16px;margin-bottom:16px;background:#fff}.pe-small-actions{display:flex;gap:8px}.pe-small-actions .pe-button{flex:1;padding:0 8px}.pe-small .pe-error{margin-bottom:12px}
.pe-toast{position:fixed;z-index:100;left:50%;bottom:80px;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);padding:10px 14px;border:1px solid #f0b39a;border-radius:6px;color:#b94d28;background:#fff1ea;font-size:13px;font-weight:600;pointer-events:none;text-align:center;box-shadow:0 8px 24px rgba(36,50,61,.16);animation:pe-toast-in-out 2.6s ease both}.pe-main .pe-toast{position:absolute;bottom:104px}@keyframes pe-toast-in-out{0%{opacity:0;transform:translate(-50%,8px)}12%{opacity:1;transform:translate(-50%,0)}82%{opacity:1;transform:translate(-50%,0)}100%{opacity:0;transform:translate(-50%,-4px)}}
.pe-dialog button:active{background:#e8edf1}.pe-dialog .pe-primary:active{background:#293d4b}
@media(max-width:820px){
body:has(.pe-main[open]){overflow:hidden}.pe-main{width:100%;max-width:100%;height:var(--remote-viewport-height,100dvh);max-height:var(--remote-viewport-height,100dvh);margin:0;inset:0 auto auto 0;border:0;border-radius:0;box-shadow:none}.pe-header{height:56px;min-height:56px;padding:6px 16px}.pe-config{padding:12px 16px}.pe-scroll{padding:0 16px 16px}.pe-footer{padding:8px 16px calc(12px + env(safe-area-inset-bottom))}.pe-notice{padding:8px 16px}.pe-config .pe-button{padding:0 10px}
}
@media(max-width:350px){.pe-header{padding-left:12px;padding-right:12px}.pe-config{padding-left:12px;padding-right:12px}.pe-scroll{padding-left:12px;padding-right:12px}.pe-footer{padding-left:12px;padding-right:12px}.pe-row,.pe-columns{grid-template-columns:20px minmax(0,1fr) 68px 44px;column-gap:6px}.pe-small-actions{gap:6px}.pe-small-actions .pe-button{font-size:13px;padding:0 6px}}
@media(max-height:450px){.pe-header{height:48px;min-height:48px}.pe-config{padding-top:6px;padding-bottom:6px}.pe-config>.pe-label,.pe-save-status{display:none}.pe-footer{padding-top:6px;padding-bottom:6px}}

/* Fade without transform so fixed menus keep the viewport as their containing block. */
@keyframes pe-dialog-in {from {opacity:0;} to {opacity:1;}}
@keyframes pe-backdrop-in {from {opacity:0;} to {opacity:1;}}
.pe-dialog[open] {animation:pe-dialog-in 180ms cubic-bezier(.2,.8,.2,1) both;}
.pe-dialog[open]::backdrop {animation:pe-backdrop-in 160ms ease-out both;background:rgba(27,44,59,.42);}
@media(max-width:820px){.pe-dialog[open] {animation-duration:160ms;}}
@media(prefers-reduced-motion:reduce){.pe-dialog[open],.pe-dialog[open]::backdrop{animation:none;}}


.pe-dialog h2,.pe-dialog h3,.pe-dialog p { margin-top:0; }
.pe-dialog svg { fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
.pe-dialog button { touch-action:manipulation; }
/* Match the existing remote console; every rule is scoped to the editor or its entry. */
.edit-plan-entry { border-color:var(--line-strong);border-radius:3px;color:var(--ink);background:var(--surface);font-family:inherit;font-size:13px;font-weight:650;padding:0 8px; }
.edit-plan-entry:hover {color:#fff;background:var(--graphite-soft);border-color:var(--graphite-soft);}
.pe-dialog {--pe-ink:var(--ink);--pe-muted:var(--muted);--pe-line:var(--line);--pe-soft:var(--surface-soft);font-family:inherit;line-height:1.5;border:1px solid var(--line-strong);border-radius:4px;color:var(--ink);background:var(--surface);}
.pe-dialog h2,.pe-dialog h3,.pe-dialog p {margin:0;}
.pe-dialog button {font-family:inherit;font-weight:600;font-size:13px;}
.pe-main {width:min(620px,calc(100vw - 32px));height:min(650px,calc(var(--remote-viewport-height,100dvh) - 32px));max-height:calc(var(--remote-viewport-height,100dvh) - 32px);margin:auto;inset:0;border-top:3px solid var(--accent);-webkit-user-select:none;user-select:none;}
.pe-main input,.pe-main textarea,.pe-main [contenteditable="true"] {-webkit-user-select:text;user-select:text;}
.pe-header {height:54px;min-height:54px;padding:5px 16px;background:var(--surface);}
.pe-heading h2,.pe-small h2 {font-size:17px;font-weight:700;line-height:24px;}
.pe-config {padding:12px 16px;background:var(--surface-soft);}
.pe-config>.pe-label {font-size:12px;margin-bottom:6px;}
.pe-config-controls {gap:6px;}.pe-dialog .pe-button,.pe-dialog .pe-icon,.pe-dialog .pe-hero-button,.pe-dialog .pe-level-box,.pe-dialog .pe-row-tool,.pe-dialog .pe-small input {border-radius:3px;}.pe-dialog .pe-button,.pe-dialog .pe-icon,.pe-dialog .pe-hero-button,.pe-dialog .pe-level-box,.pe-dialog .pe-row-tool {height:40px;min-height:40px;}
.pe-icon {width:40px;}.pe-hero-button,.pe-level-box,.pe-button,.pe-row-tool {border-color:var(--line-strong);}
.pe-dialog .pe-profile-button {display:flex;flex:1;min-width:0;height:40px;min-height:40px;align-items:center;justify-content:space-between;gap:8px;padding:0 8px;border:1px solid var(--line-strong);border-radius:3px;background:#fff;color:var(--pe-ink);font-size:14px;font-weight:400;text-align:left;}
.pe-profile-button span {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.pe-profile-button svg {width:14px;height:14px;flex-shrink:0;}
@media(max-width:350px){.pe-config .pe-profile-button {padding-left:6px;padding-right:2px;}}
.pe-profile-menu button {overflow-wrap:anywhere;}
.pe-dialog .pe-hero-button {font-size:14px;font-weight:500;}
.pe-level-box input {height:38px;font-size:16px;}
.pe-primary {background:var(--accent);border-color:var(--accent);color:#fff;}
.pe-primary:hover {background:var(--accent-dark);border-color:var(--accent-dark);}
.pe-scroll {padding:0 16px 12px;overscroll-behavior:none;scrollbar-gutter:stable;}
.pe-scroll:has(> .pe-rows > .pe-empty) {display:flex;flex-direction:column;}
.pe-scroll > .pe-rows:has(> .pe-empty) {flex:1;display:flex;align-items:center;justify-content:center;}
.pe-list-fixed {flex-shrink:0;padding:0 16px;background:var(--surface);overflow:hidden;scrollbar-gutter:stable;scrollbar-width:thin;}
.pe-list-heading {padding:12px 0 8px;}
.pe-list-heading h3 {font-size:13px;}
.pe-list-heading p {display:none;}
.pe-columns,.pe-row {grid-template-columns:20px minmax(0,1fr) 72px 40px;column-gap:6px;}
.pe-columns {font-size:12px;padding-bottom:7px;}
.pe-row {padding:6px 0;}
.pe-row.is-removing {overflow:hidden;min-height:0;}
.pe-footer {display:flex;align-items:center;justify-content:flex-end;gap:12px;padding:8px 16px 12px;background:var(--surface-soft);}
.pe-save-status {display:none;}
#peSave {min-width:88px;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}
#peSave:disabled {pointer-events:none;outline:none;box-shadow:none;background:#f3f5f7;color:#9aa3aa;border-color:#e4e8ec;}
.pe-list-heading h3 {white-space:nowrap;}
.pe-list-actions {display:flex;gap:5px;}
.pe-list-actions .pe-button {height:32px;min-height:32px;padding:0 7px;font-size:12px;white-space:nowrap;}
.pe-menu {top:46px;width:max-content;max-width:calc(100vw - 32px);padding:3px;border-radius:3px;border-color:var(--line-strong);}
.pe-menu button {height:34px;gap:7px;padding:0 8px;white-space:nowrap;border-radius:2px;font-size:13px;font-weight:500;}
.pe-small {border-top:3px solid var(--accent);padding:16px;}
.pe-small h2 {margin-bottom:10px;}
.pe-small p {font-size:13px;margin-bottom:14px;}
.pe-small input {border-radius:3px;}
.pe-small-actions {gap:6px;}
.pe-small-actions .pe-button {font-size:13px;}
@media(max-width:350px){
 .pe-main {width:calc(100vw - 16px);height:calc(var(--remote-viewport-height,100dvh) - 24px);max-height:calc(var(--remote-viewport-height,100dvh) - 24px);}
 .pe-header,.pe-config,.pe-scroll,.pe-list-fixed,.pe-footer {padding-left:10px;padding-right:10px;}
 .pe-columns,.pe-row {grid-template-columns:18px minmax(0,1fr) 62px 36px;column-gap:5px;}
 .pe-config .pe-button {padding:0 8px;gap:4px;}
 .pe-hero-button {padding:0 7px;}
}
@media(max-height:450px){
 .pe-main{height:calc(var(--remote-viewport-height,100dvh) - 12px);max-height:calc(var(--remote-viewport-height,100dvh) - 12px);}
 .pe-header{height:44px;min-height:44px;}
 .pe-config {padding-top:6px;padding-bottom:6px;}
 .pe-footer {padding-top:6px;padding-bottom:6px;}
}

/* Compact client-style plan rows. */
.pe-columns,.pe-row {grid-template-columns:28px 20px minmax(0,1fr) 76px 40px;column-gap:5px;}
.pe-order,.pe-columns span:nth-child(2),.pe-columns span:nth-child(3) {text-align:center;}
.pe-columns span:nth-child(4) {white-space:nowrap;font-size:11px;text-align:center;}
.pe-drag-handle {display:flex;align-items:center;justify-content:center;align-self:stretch;width:28px;height:auto;margin:-6px 0;padding:0;border:0;border-radius:0;background:transparent;color:var(--muted);cursor:grab!important;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}
.pe-drag-handle svg {width:18px;height:22px;stroke-width:3;}
.pe-drag-handle:active {cursor:grabbing!important;}
.pe-drag-placeholder {opacity:.3;background:var(--surface-soft);}
.pe-drag-chosen {background:var(--surface-soft);}
.pe-drag-chosen .pe-drag-handle,.pe-drag-preview .pe-drag-handle {background:var(--line);}
.pe-drag-preview {opacity:.95!important;background:var(--surface);box-shadow:0 2px 8px #24323d26;pointer-events:none;}
.pe-row .pe-row-tool {height:40px;min-width:0;width:40px;padding:0;border-radius:3px;border-color:var(--line-strong);}
.pe-row .pe-row-tool svg {width:16px;height:16px;}
.pe-row .pe-hero-button {padding:0 6px;font-size:14px;}
.pe-row .pe-level-box input {padding:0 2px;}
.pe-dialog input:focus,.pe-dialog .pe-hero-button:focus {outline:none!important;box-shadow:none;}
.pe-level-box:focus-within{outline:none;}
.pe-level-box:has(input[aria-invalid=true]) {outline:2px solid #b94b47;}
.pe-hero-menu {position:fixed;z-index:20;display:grid;gap:2px;overflow:auto;overscroll-behavior:contain;padding:5px;background:var(--surface);border:1px solid var(--line-strong);border-radius:4px;box-shadow:0 9px 22px rgba(38,56,67,.16);}
.pe-hero-menu[hidden] {display:none;}
.pe-hero-section {position:relative;display:grid;gap:2px;min-width:0;}
.pe-hero-section + .pe-hero-section {margin-top:6px;}
.pe-hero-menu .pe-hero-group{position:sticky;top:-5px;z-index:1;display:flex;align-items:center;justify-content:center;gap:3px;padding:7px 2px;background:var(--surface);border:0;color:var(--accent);font-size:14px;font-weight:700;text-align:center;white-space:nowrap;}
.pe-hero-group::before,.pe-hero-group::after {content:"";flex:1;min-width:0;height:1px;background:var(--accent);}
.pe-hero-menu button {display:block;width:100%;min-height:40px;padding:8px 11px;text-align:left;border:0;border-radius:2px;background:transparent;color:var(--ink);font-size:14px;font-weight:650;}
.pe-hero-menu button:hover,.pe-hero-menu button:focus-visible {background:var(--surface-soft);color:var(--ink);outline:none;}
.pe-hero-menu button[aria-selected=true] {background:rgba(225,100,56,.12);color:var(--accent-dark);box-shadow:inset 3px 0 0 var(--accent);font-weight:700;}
@media(max-width:350px){.pe-columns,.pe-row{grid-template-columns:28px 16px minmax(0,1fr) 68px 36px;column-gap:3px;}.pe-row .pe-row-tool{width:36px;}.pe-row .pe-hero-button{font-size:13px;padding:0 4px;}.pe-row .pe-hero-button svg{width:10px;}}
