:root{
  color-scheme:light;
  --bg:#f4f8fc;
  --surface:#ffffff;
  --surface-soft:#f7f9fc;
  --text:#172033;
  --muted:#6d788a;
  --border:#d7e0eb;
  --border-strong:#bdc9d8;
  --primary:#3f7fdf;
  --primary-hover:#2f6fcf;
  --primary-soft:#e8f1ff;
  --stage:#cfe1f6;
  --category:#f1d8c3;
  --domain:#d6ead7;
  --scene:#f0d3df;
  --success:#2f8b58;
  --warning:#c8741e;
  --danger:#b33a45;
  --shadow:0 14px 40px rgba(38,57,82,.16);
  --font:"Microsoft YaHei","PingFang SC","Noto Sans CJK SC",system-ui,sans-serif;
}

*{box-sizing:border-box}
html{background:var(--bg);color:var(--text);font-family:var(--font);letter-spacing:0}
body{margin:0;min-width:320px;background:var(--bg)}
button,input,select,textarea{font:inherit;letter-spacing:0}
button{color:inherit}
[hidden]{display:none!important}

.app-shell{width:100%;min-height:100vh}
.pool-toolbar{position:relative;z-index:30;display:flex;justify-content:space-between;align-items:center;gap:20px;padding:14px 20px 13px;background:rgba(255,255,255,.97);border-bottom:1px solid #c9d9ec;box-shadow:0 2px 8px rgba(52,77,108,.07)}
.pool-heading{display:grid;gap:7px;min-width:0}
.pool-title{display:flex;align-items:center;gap:9px;min-width:0}
.pool-title h1{margin:0;font-size:21px;line-height:1.2;font-weight:500;white-space:nowrap}
.brand-mark{position:relative;display:block;width:17px;height:17px;flex:none}
.brand-mark span{position:absolute;width:5px;height:5px;border:1.5px solid currentColor;background:var(--surface);border-radius:1px}
.brand-mark span:nth-child(1){left:6px;top:0}
.brand-mark span:nth-child(2){left:0;bottom:0}
.brand-mark span:nth-child(3){right:0;bottom:0}
.brand-mark:before,.brand-mark:after{content:"";position:absolute;background:currentColor}
.brand-mark:before{left:8px;top:5px;width:1px;height:5px}
.brand-mark:after{left:2px;right:2px;top:9px;height:1px}
.sync-state{display:inline-flex;align-items:center;gap:6px;margin-left:4px;padding:3px 8px;border:1px solid var(--border);border-radius:999px;color:var(--muted);font-size:12px;white-space:nowrap}
.sync-state i{display:block;width:7px;height:7px;border-radius:50%;background:var(--warning)}
.sync-state.is-online i{background:var(--success)}
.sync-state.is-error{color:var(--danger);border-color:#e8bfc4}
.sync-state.is-error i{background:var(--danger)}
.pool-breadcrumb{display:flex;align-items:center;gap:6px;min-width:0;flex-wrap:wrap;color:var(--muted);font-size:13px}
.pool-breadcrumb .separator{color:#9ba7b7}
.pool-breadcrumb .is-current{color:var(--text);font-weight:500}
.toolbar-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}

.button,.user-button,.icon-button{border:1px solid var(--border-strong);background:var(--surface);cursor:pointer;transition:border-color .16s ease,background .16s ease,box-shadow .16s ease}
.button{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:34px;padding:6px 12px;border-radius:6px;white-space:nowrap}
.button:hover{background:var(--surface-soft);border-color:#9fb0c5}
.button:focus-visible,.user-button:focus-visible,.icon-button:focus-visible,.input:focus,.select:focus,.textarea:focus{outline:2px solid rgba(63,127,223,.28);outline-offset:1px;border-color:var(--primary)}
.button:disabled{cursor:not-allowed;opacity:.5}
.button-primary{background:var(--primary);border-color:var(--primary);color:white}
.button-primary:hover{background:var(--primary-hover);border-color:var(--primary-hover)}
.button-danger{border-color:#d9a9ae;background:#fff;color:var(--danger)}
.button-danger:hover{border-color:var(--danger);background:#fff4f5}
.button-block{width:100%}
.user-button{display:inline-flex;align-items:center;gap:7px;min-height:34px;padding:5px 9px;border-radius:6px;max-width:150px}
.user-button:hover{background:var(--surface-soft)}
.user-button>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-avatar{position:relative;width:20px;height:20px;flex:none;border-radius:50%;background:#dfe9f5}
.user-avatar:before{content:"";position:absolute;left:7px;top:4px;width:6px;height:6px;border-radius:50%;background:#66758a}
.user-avatar:after{content:"";position:absolute;left:4px;bottom:3px;width:12px;height:6px;border-radius:6px 6px 3px 3px;background:#66758a}
.icon-button{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border-color:transparent;border-radius:6px;background:transparent;font-size:24px;line-height:1;color:var(--muted)}
.icon-button:hover{background:#edf2f7;color:var(--text)}

.pool-field{position:relative;width:100%;height:700px;overflow:hidden;background-color:#f3f8fd;background-image:linear-gradient(rgba(63,127,223,.10) 1px,transparent 1px),linear-gradient(90deg,rgba(63,127,223,.10) 1px,transparent 1px);background-size:32px 32px;border-bottom:1px solid #c9d9ec}
.pool-links,.pool-nodes{position:absolute;inset:0;width:100%;height:100%;will-change:transform}
.pool-links{pointer-events:none}
.pool-links line{stroke:#a9c5e6;stroke-width:1.25}
.pool-field.is-panning,.pool-field.is-panning .opp-node{cursor:grabbing;user-select:none}
.opp-node{position:absolute;display:flex;align-items:center;justify-content:center;text-align:center;overflow:hidden;padding:7px;border:1px solid rgba(130,151,177,.35);border-radius:8px;color:var(--text);font-weight:500;cursor:pointer;box-shadow:0 5px 18px rgba(49,70,96,.10);transition:box-shadow .18s ease,transform .18s ease;touch-action:none}
.opp-node:hover,.opp-node:focus-visible{box-shadow:0 8px 24px rgba(49,70,96,.18)}
.opp-node>span{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;max-width:100%}
.node-count{position:absolute;top:5px;right:6px;display:flex;align-items:center;justify-content:center;min-width:22px;height:20px;padding:0 5px;border-radius:999px;background:#1d2634;color:#fff;font-size:12px;font-weight:500;font-variant-numeric:tabular-nums}
.opp-root{width:112px;height:64px;background:var(--primary);color:#fff}
.opp-stage{width:120px;height:64px;background:var(--stage)}
.opp-category{width:128px;height:64px;background:var(--category)}
.opp-domain{width:124px;height:60px;background:var(--domain)}
.opp-scene{width:130px;height:58px;background:var(--scene)}
.opp-node.is-active{box-shadow:0 0 0 3px #6da5f5,0 8px 24px rgba(49,70,96,.18)}

.pool-detail{position:absolute;top:16px;right:16px;width:min(420px,calc(100% - 32px));z-index:20;padding:18px;max-height:650px;overflow:auto;background:rgba(255,255,255,.96);color:var(--text);border:1px solid #cbd6e3;border-radius:8px;box-shadow:var(--shadow);backdrop-filter:blur(18px) saturate(130%)}
.pool-detail-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.pool-detail-controls{display:flex;align-items:center;gap:4px;flex:none}
.pool-detail h2{margin:9px 0 5px;font-size:20px;line-height:1.35;font-weight:500}
.pool-detail p{margin:0}
.priority-badge{display:inline-flex;align-items:center;min-height:24px;padding:3px 8px;border-radius:999px;background:var(--primary-soft);color:#2466bd;font-size:12px;font-weight:500}
.muted{color:var(--muted)}
.pool-facts{display:grid;gap:12px;margin:18px 0}
.pool-facts div{display:grid;gap:4px}
.pool-facts dt{color:var(--muted);font-size:13px}
.pool-facts dd{margin:0;line-height:1.65}
.pool-savings{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;border-top:1px solid var(--border);padding-top:14px}
.pool-savings div{display:grid;gap:5px;min-width:0}
.pool-savings span{color:var(--muted);font-size:13px}
.pool-savings strong{font-weight:500;overflow-wrap:anywhere;line-height:1.5}
.detail-author{margin-top:14px!important;padding-top:12px;border-top:1px solid var(--border);color:var(--muted);font-size:12px}
.pool-empty{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);margin:0;color:var(--muted);font-size:13px;pointer-events:none}
.offline-notice{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:25;display:grid;gap:7px;width:min(440px,calc(100% - 32px));padding:18px;background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:var(--shadow);text-align:center}
.offline-notice span{color:var(--muted);line-height:1.6}
.offline-notice code{color:var(--text)}

.pool-legend{padding:12px 20px 15px;background:#f7faff;border-bottom:1px solid #c9d9ec}
.legend-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:9px}
.legend-head strong{font-weight:500}
.legend-head span{font-size:13px;font-weight:500}
.legend-items{display:grid;grid-template-columns:repeat(5,minmax(130px,1fr));gap:8px 18px;padding-top:10px;border-top:1px solid var(--border)}
.legend-item{display:grid;grid-template-columns:12px max-content auto;justify-content:start;align-items:center;gap:6px;min-width:0;min-height:24px}
.legend-dot{width:12px;height:12px;border-radius:3px;box-shadow:0 0 0 1px rgba(23,32,51,.10)}
.root-dot{background:var(--primary)}.stage-dot{background:#79aeea}.category-dot{background:#df914d}.domain-dot{background:#72bd7e}.scene-dot{background:#ce78a2}
.legend-count{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:24px;padding:0 8px;border-radius:999px;background:#1d2634;color:#fff;font-size:12px;font-weight:500;font-variant-numeric:tabular-nums;box-shadow:0 2px 7px rgba(28,39,55,.16)}

.modal{width:min(680px,calc(100vw - 32px));max-height:calc(100vh - 40px);padding:0;border:1px solid var(--border);border-radius:8px;background:var(--surface);color:var(--text);box-shadow:0 22px 70px rgba(24,38,57,.28);overflow:auto}
.modal::backdrop{background:rgba(19,31,47,.45);backdrop-filter:blur(3px)}
.modal>form{padding:22px}
.modal-small{width:min(420px,calc(100vw - 32px))}
.modal-wide{width:min(1100px,calc(100vw - 32px))}
.modal-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.modal-head h2{margin:5px 0 0;font-size:21px;font-weight:500}
.eyebrow{color:var(--primary);font-size:12px;font-weight:500}
.modal-intro{margin:14px 0 18px;color:var(--muted);line-height:1.65}
.form-grid{display:grid;gap:14px}
.two-columns{grid-template-columns:repeat(2,minmax(0,1fr))}
.span-two{grid-column:1/-1}
.form-field{display:grid;align-content:start;gap:6px;min-width:0;color:var(--muted);font-size:13px}
.field-label{display:block;margin-bottom:7px;color:var(--muted);font-size:13px}
.input,.select,.textarea{width:100%;border:1px solid var(--border-strong);border-radius:6px;background:#fff;color:var(--text)}
.input,.select{height:38px;padding:7px 10px}
.textarea{padding:9px 10px;line-height:1.55;resize:vertical}
.input::placeholder,.textarea::placeholder{color:#a0aaba}
.form-error{min-height:20px;margin:7px 0 0;color:var(--danger);font-size:13px}
.modal-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:20px;padding-top:16px;border-top:1px solid var(--border)}
.split-actions{justify-content:space-between}
.split-actions>div{display:flex;gap:8px}
.inline-status{min-height:21px;margin-top:12px;color:var(--muted);font-size:13px;line-height:1.5}
.inline-status.is-success{color:var(--success)}
.inline-status.is-error{color:var(--danger)}
.scene-editor{display:grid;grid-template-columns:minmax(320px,.85fr) minmax(420px,1.15fr);gap:0;margin:18px -22px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
.scene-inputs,.scene-preview{padding:20px 22px;min-width:0}
.scene-inputs h3{margin:0 0 14px;font-size:16px;font-weight:500}
.scene-preview{border-left:1px solid var(--border);background:var(--surface-soft);max-height:620px;overflow:auto}
.generate-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.preview-empty{display:grid;place-content:center;gap:8px;min-height:360px;text-align:center;color:var(--muted)}
.preview-empty strong{color:var(--text);font-size:16px;font-weight:500}
.preview-empty span{max-width:330px;line-height:1.65}

.toast{position:fixed;right:20px;bottom:20px;z-index:100;max-width:min(380px,calc(100vw - 40px));padding:11px 14px;border:1px solid #b8d1bf;border-radius:6px;background:#f2fbf4;color:#24633e;box-shadow:0 10px 30px rgba(38,57,82,.18);line-height:1.5}

@media(max-width:900px){
  .pool-toolbar{align-items:flex-start}
  .toolbar-actions{max-width:430px}
  .scene-editor{grid-template-columns:1fr}
  .scene-preview{border-left:0;border-top:1px solid var(--border);max-height:none}
  .legend-items{grid-template-columns:repeat(3,minmax(130px,1fr))}
}

@media(max-width:620px){
  .pool-toolbar{display:grid;padding:12px;gap:11px}
  .pool-title{flex-wrap:wrap}
  .pool-title h1{font-size:20px}
  .toolbar-actions{justify-content:flex-start;max-width:none}
  .button{padding-inline:10px}
  .button-icon-text{display:none}
  .user-button{margin-left:auto}
  .pool-field{height:720px;background-size:24px 24px}
  .pool-detail{top:auto;bottom:10px;right:10px;width:calc(100% - 20px);max-height:430px;padding:15px}
  .pool-savings{grid-template-columns:1fr}
  .pool-legend{padding:12px}
  .legend-items{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 10px}
  .legend-item{grid-template-columns:10px max-content auto;gap:5px;font-size:13px}
  .legend-dot{width:10px;height:10px}
  .legend-count{min-width:26px;height:22px;padding:0 6px}
  .opp-root{width:112px;height:64px}.opp-stage{width:120px;height:64px}.opp-category{width:128px;height:64px}.opp-domain{width:124px;height:60px}.opp-scene{width:130px;height:58px}
  .modal>form{padding:18px}
  .two-columns{grid-template-columns:1fr}
  .span-two{grid-column:auto}
  .scene-editor{margin-inline:-18px}
  .scene-inputs,.scene-preview{padding:18px}
  .split-actions{align-items:flex-end}
  .split-actions>span{max-width:150px;font-size:12px}
}

@media(prefers-reduced-motion:reduce){.opp-node,.button,.user-button,.icon-button{transition:none}}
