/* NX customer template copies, isolated UI and preview, v0.1 */
body.theme-nx-custom .nx-filigree .fg-card {padding:calc(16px * var(--nx-custom-density,1))}
body.theme-nx-custom .nx-filigree .fg-metrics {gap:calc(12px * var(--nx-custom-density,1))}
body.theme-nx-custom .nx-filigree .fg-field {margin-bottom:calc(15px * var(--nx-custom-density,1))}
body.theme-nx-custom .nx-filigree .fg-card {border-radius:var(--fg-radius-lg,16px)}
.nx-customer-theme-overlay{position:fixed;inset:0;z-index:58000;background:rgba(5,11,21,.78);display:grid;place-items:center;padding:16px}
.nx-customer-theme-dialog{--cct-bg:#172435;--cct-panel:#1e2d3e;--cct-line:#44576b;--cct-fg:#eaf2fa;--cct-muted:#b7c7d8;max-height:96vh;display:flex;flex-direction:column;min-height:0;width:min(1100px,100%);overflow:hidden;background:var(--cct-bg);color:var(--cct-fg);border:1px solid var(--cct-line);border-radius:14px;box-shadow:0 30px 95px rgba(0,0,0,.32)}
.nx-customer-theme-dialog.nx-customer-clone{max-width:510px}
.nx-customer-dialog-head{padding:20px 24px;display:flex;align-items:flex-start;justify-content:space-between;gap:15px;border-bottom:1px solid var(--cct-line)}
.nx-customer-dialog-head span{color:#95adc5;font-weight:650;font-size:10px;letter-spacing:.13em}
.nx-customer-dialog-head h2{font-size:22px;letter-spacing:-.027em;margin:7px 0 5px;font-weight:640}
.nx-customer-dialog-head h2 small{font-size:11px;font-weight:500;color:var(--cct-muted)}
.nx-customer-dialog-head p{margin:0;color:var(--cct-muted);font-size:12px;line-height:1.6}
.nx-customer-dialog-head [data-nx-close]{width:42px;height:42px;border:1px solid #52677d;border-radius:9px;background:transparent;color:var(--cct-fg);font-size:24px;cursor:pointer}
.nx-customer-dialog-head [data-nx-close]:hover{background:#33485d}
.nx-customer-copy-form{padding:24px;display:grid;gap:18px}
.nx-customer-copy-form>label,.nx-customer-name-field{display:grid;gap:9px;font-size:12px;font-weight:650;color:var(--cct-muted)}
.nx-customer-copy-form input[type=text],.nx-customer-copy-form input:not([type]),.nx-customer-name-field input{height:44px;background:#23354a;color:var(--cct-fg);border:1px solid #5b748e;border-radius:9px;padding:8px 12px;width:100%;font:inherit}
.nx-customer-source{border:1px solid var(--cct-line);border-radius:10px;padding:14px;background:var(--cct-panel);display:grid;gap:5px}
.nx-customer-source span{font-size:11px;color:var(--cct-muted)}.nx-customer-source strong{font-size:15px}
.nx-customer-checkbox{display:flex!important;align-items:flex-start;gap:9px!important;line-height:1.5!important;font-weight:500!important}
.nx-customer-checkbox input{accent-color:#a1c8f5;min-width:18px;width:18px;height:18px;flex-shrink:0}
.nx-customer-small{color:var(--cct-muted);font-size:12px}
.nx-customer-copy-form footer,.nx-customer-editor-foot{display:flex;justify-content:flex-end;gap:10px;align-items:center}
.nx-customer-theme-dialog button{cursor:pointer}
.nx-customer-theme-dialog button:disabled{opacity:.5;cursor:not-allowed}
.nx-customer-theme-dialog :is(button,input,select):focus-visible{outline:2px solid #a4cefc;outline-offset:3px}
.nx-customer-copy-form footer button,.nx-customer-editor-foot button{background:transparent;border:1px solid #52677d;color:var(--cct-fg);border-radius:8px;min-height:42px;padding:9px 15px}
.nx-customer-copy-form footer .primary,.nx-customer-editor-foot .primary{background:#a1c8f5;border-color:#a1c8f5;color:#122236;font-weight:700}
.nx-customer-copy-feedback{font-size:12px;color:#ffb5ae;min-height:0;line-height:1.5}
.nx-customer-editor-grid{display:grid;grid-template-columns:minmax(340px,420px) minmax(0,1fr);flex:1;min-height:0;overflow:hidden}
.nx-customer-editor-form{min-height:0;overflow-y:auto;padding:22px 24px;border-right:1px solid var(--cct-line);display:grid;align-content:start;gap:12px}
.nx-customer-editor-form h3{font-size:12px;letter-spacing:.04em;margin:18px 0 2px;font-weight:680;color:var(--cct-muted)}
.nx-customer-color-list{display:grid;gap:3px}
.nx-customer-color-row{display:grid;grid-template-columns:minmax(120px,1fr) 40px 94px;gap:9px;align-items:center;min-height:42px;font-size:12px;color:var(--cct-fg)}
.nx-customer-color-row input[type=color]{width:40px;height:36px;background:transparent;padding:1px;border:1px solid #52677d;border-radius:7px;cursor:pointer}
.nx-customer-color-row input[type=text]{height:36px;width:94px;min-width:0;font:600 12px ui-monospace,monospace;background:#26394c;color:#e9f2fd;border:1px solid #546b82;border-radius:7px;padding:0 6px}
.nx-customer-number{display:grid;gap:7px;color:var(--cct-muted);font-size:12px;font-weight:650}
.nx-customer-number>div{display:flex;align-items:center;gap:12px}
.nx-customer-number input{min-height:42px;width:100%;accent-color:#9ec8f3}
.nx-customer-number output{width:50px;text-align:right;color:var(--cct-fg);font-variant-numeric:tabular-nums;font-weight:600}
.nx-customer-editor-preview{min-height:0;display:flex;flex-direction:column}
.nx-customer-preview-bar{display:flex;align-items:center;justify-content:space-between;min-height:43px;gap:12px;padding:9px 20px;background:var(--cct-panel);font-size:11px;color:var(--cct-muted);border-bottom:1px solid var(--cct-line)}
.nx-customer-preview-bar span:last-child{font-size:10px}
.nx-customer-preview-surface{--ct-bg:#f4f7fb;--ct-surface:#fff;--ct-surface2:#f8fafc;--ct-text:#17283e;--ct-muted:#52667f;--ct-border:#d7e0ea;--ct-accent:#ae541e;--ct-radius:12px;--ct-density:1;overflow-y:auto;flex:1;min-height:0;background:var(--ct-bg);padding:28px;color:var(--ct-text)}
.nx-customer-preview-shell{border:1px solid var(--ct-border);border-radius:var(--ct-radius);background:var(--ct-surface);max-width:630px;margin:0 auto;box-shadow:0 4px 19px rgba(0,0,0,.045);overflow:hidden}
.nx-customer-preview-shell nav{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--ct-border);background:var(--ct-surface2);padding:calc(16px * var(--ct-density));color:var(--ct-accent);font-size:13px;font-weight:750}
.nx-customer-preview-shell main{padding:calc(22px * var(--ct-density))}
.nx-customer-overline{font-size:10px;font-weight:700;color:var(--ct-accent);letter-spacing:.12em}
.nx-customer-preview-shell h2{font-size:26px;letter-spacing:-.035em;margin:10px 0}
.nx-customer-preview-shell p{font-size:12px;color:var(--ct-muted);line-height:1.6}
.nx-customer-preview-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:22px 0}
.nx-customer-preview-stats div{background:var(--ct-surface2);border:1px solid var(--ct-border);border-radius:var(--ct-radius);padding:calc(15px * var(--ct-density))}
.nx-customer-preview-stats small{display:block;color:var(--ct-muted);font-size:11px}
.nx-customer-preview-stats strong{display:block;font-size:24px;font-weight:650;margin-top:6px}
.nx-customer-preview-shell article{display:flex;flex-wrap:wrap;gap:9px;align-items:center;justify-content:space-between;border-radius:var(--ct-radius);padding:calc(15px * var(--ct-density));border:1px solid var(--ct-border)}
.nx-customer-preview-shell article strong{font-size:12px}
.nx-customer-preview-shell article p{margin:0;font-size:11px}
.nx-customer-preview-shell article button{border:0;border-radius:calc(var(--ct-radius) - 3px);padding:9px 16px;background:var(--ct-accent);color:var(--ct-bg);font-weight:650}
.nx-customer-editor-foot{padding:13px 20px;border-top:1px solid var(--cct-line);justify-content:space-between}
.nx-customer-editor-foot>div:first-child{font-size:11px;color:var(--cct-muted)}
.nx-customer-editor-foot>div:last-child{display:flex;gap:9px;flex-wrap:wrap}
.nx-customer-editor-foot .nx-customer-danger{border-color:#8a4c58;color:#ffb4bb}
.nx-template-custom-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
.nx-template-custom-actions button{min-height:40px;border:1px solid var(--line);border-radius:9px;padding:8px 12px;background:var(--panel-solid);color:var(--text);font-weight:600;cursor:pointer}
.nx-template-custom-actions button:hover{border-color:var(--accent)}
.nx-template-custom-actions button:disabled{opacity:.5;cursor:default}
@media(max-width:760px){
 .nx-customer-theme-overlay{padding:4px}
 .nx-customer-theme-dialog{max-height:98dvh;max-width:100%;border-radius:10px}
 .nx-customer-editor-grid{grid-template-columns:1fr;overflow:auto}
 .nx-customer-editor-form{overflow:visible;padding:14px}
 .nx-customer-editor-preview{min-height:380px}
 .nx-customer-preview-surface{min-height:350px;padding:16px}
 .nx-customer-editor-foot{flex-wrap:wrap}
 .nx-customer-dialog-head{padding:14px 17px}
 .nx-customer-color-row{grid-template-columns:minmax(0,1fr) 40px 92px}
}

/* Direct factory editor: on narrow screens prioritize editable controls.
   Preview can be explicitly opened without obscuring the form. */
.nx-customer-editor-mobile-switch{display:none}
@media(max-width:760px){
 .nx-customer-editor-mobile-switch{display:flex;gap:8px;padding:9px 14px;border-bottom:1px solid var(--cct-line)}
 .nx-customer-editor-mobile-switch button{flex:1;min-height:40px;border:1px solid #52677d;border-radius:8px;background:var(--cct-panel);color:var(--cct-fg)}
 .nx-customer-editor-mobile-switch button.selected{border-color:#a1c8f5;box-shadow:inset 0 -2px #a1c8f5}
 .nx-customer-editor-grid{overflow:hidden;min-height:0}
 .nx-customer-editor-form{overflow-y:auto;min-height:0}
 .nx-customer-editor-preview{display:none;min-height:0}
 .nx-customer-editor-grid.show-preview .nx-customer-editor-form{display:none}
 .nx-customer-editor-grid.show-preview .nx-customer-editor-preview{display:flex}
 .nx-customer-editor-grid.show-preview .nx-customer-preview-surface{min-height:0}
}

.nx-customer-color-row.nx-preview-selected{outline:2px solid var(--accent,#ff7a1a);outline-offset:2px;border-radius:6px}
