/* 服务设置 · 自定义接入 */
.custom-connect{margin:0 0 25px;padding:23px;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--text)}
.custom-connect-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.custom-connect-head h3{margin:0 0 7px;font-size:17px}
.custom-connect-head p{margin:0;max-width:620px;color:var(--dim);font-size:11px;line-height:1.8}
.custom-connect-head .ui-button{flex:none;white-space:nowrap}
.custom-connect-head .ui-button[hidden]{display:none}
.custom-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px;margin-top:20px}
.custom-list:empty{display:none}
.custom-empty{margin:0;color:var(--dim);font-size:11px;line-height:1.8}
.custom-list>.custom-empty{grid-column:1/-1}
.custom-status{margin:12px 0 0;color:var(--dim);font-size:11px;line-height:1.6;overflow-wrap:anywhere}
.custom-status:empty{display:none}
.custom-status.success,.custom-form-status.success{color:#287250}
.custom-status.error,.custom-form-status.error,.custom-card-note.error{color:#b14040}

.custom-card{min-width:0;padding:17px;border:1px solid var(--line);border-radius:10px;background:var(--bg)}
.custom-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.custom-card-head strong{font-size:13px;font-weight:550;line-height:1.6;overflow-wrap:anywhere}
.custom-kind-tag{display:inline-block;margin-left:8px;padding:1px 6px;border:1px solid var(--line);border-radius:4px;color:var(--dim);font-size:10px;vertical-align:1px}
.service-badge.failed{background:#f8e9e7;color:#b14040}
.custom-card dl{display:grid;gap:6px;margin:12px 0 0}
.custom-card dl div{display:grid;grid-template-columns:34px minmax(0,1fr);gap:8px;font-size:11px;line-height:1.6}
.custom-card dt{color:var(--dim)}
.custom-card dd{margin:0;overflow-wrap:anywhere}
.custom-card-note{margin:10px 0 0;color:var(--dim);font-size:10px;line-height:1.7;overflow-wrap:anywhere}
.custom-card-actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:14px}
.custom-card-actions select{max-width:150px;height:30px;padding:0 6px;border:1px solid var(--line);border-radius:7px;background:var(--panel);color:var(--text);font-size:11px}
.custom-action{min-height:30px;padding:0 11px;border:1px solid var(--line);border-radius:7px;background:var(--panel);color:var(--text);font:inherit;font-size:11px;cursor:pointer}
.custom-action:hover{border-color:#b8b8b8}
.custom-action:disabled{opacity:.55;cursor:wait}
.custom-action.danger-text{color:#b14040}
.custom-action[data-confirm="1"]{border-color:#c25950;background:#c25950;color:#fff}

.custom-dialog{width:min(560px,calc(100vw - 32px));max-height:calc(100dvh - 40px);margin:auto;padding:0;border:1px solid var(--line);border-radius:14px;background:var(--panel);color:var(--text);box-shadow:0 24px 70px #0000002e}
.custom-dialog::backdrop{background:#0000004d}
.custom-dialog form{display:grid;gap:14px;padding:24px}
.custom-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px}
.custom-dialog h2{margin:0;font-size:18px;font-weight:600}
.custom-close{width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:var(--dim);font-size:22px;line-height:1;cursor:pointer}
.custom-close:hover{background:var(--ui-surface);color:var(--text)}
.custom-kind{display:flex;gap:6px;margin:0;padding:0;border:0}
.custom-kind legend{margin-bottom:7px;color:var(--dim);font-size:11px}
.custom-kind label{flex:1}
.custom-kind input{position:absolute;opacity:0;pointer-events:none}
.custom-kind span{display:block;padding:9px 0;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--dim);font-size:12px;text-align:center;cursor:pointer}
.custom-kind input:checked+span{border-color:var(--accent);background:var(--accent);color:var(--panel)}
.custom-kind input:focus-visible+span{outline:2px solid var(--accent);outline-offset:2px}
.custom-kind input:disabled+span{cursor:not-allowed}
.custom-kind input:disabled:not(:checked)+span{opacity:.45}
.custom-field{display:block;min-width:0;color:var(--dim);font-size:11px}
.custom-field input,.custom-field select,.custom-field textarea{display:block;width:100%;margin-top:7px;padding:0 11px;border:1px solid var(--line);border-radius:9px;background:var(--bg);color:var(--text);font:inherit;font-size:12px;outline:none}
.custom-field input,.custom-field select{height:40px}
.custom-field textarea{min-height:76px;padding:9px 11px;line-height:1.6;resize:vertical;font-family:ui-monospace,Consolas,monospace}
.custom-field input:focus,.custom-field select:focus,.custom-field textarea:focus{border-color:var(--dim)}
.custom-field [hidden]{display:none}
.custom-presets{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:-4px}
.custom-presets[hidden]{display:none}
.custom-presets span{margin-right:2px;color:var(--dim);font-size:11px}
.custom-presets .custom-action{min-height:26px;padding:0 9px;border-radius:13px;font-size:11px}
.custom-models-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.custom-link{padding:0;border:0;background:none;color:var(--text);font:inherit;font-size:11px;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.custom-link:disabled{opacity:.55;cursor:wait}
.custom-fetched{margin-top:9px;padding:10px;border:1px solid var(--line);border-radius:9px;background:var(--bg)}
.custom-fetched[hidden]{display:none}
.custom-fetched input{height:32px;margin:0 0 9px}
.custom-chips{display:flex;flex-wrap:wrap;gap:6px;max-height:150px;overflow:auto}
.custom-chip{max-width:100%;padding:4px 9px;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--text);font:inherit;font-size:11px;overflow-wrap:anywhere;text-align:left;cursor:pointer}
.custom-chip.on{border-color:var(--accent);background:var(--accent);color:var(--panel)}
.custom-form-status{min-height:18px;margin:0;color:var(--dim);font-size:11px;line-height:1.6;overflow-wrap:anywhere}
.custom-dialog footer{display:flex;justify-content:flex-end;gap:8px}

body.night .service-badge.failed{background:#4a3130;color:#f0a7a0}
body.night .custom-status.success,body.night .custom-form-status.success{color:#7fcf9f}
body.night .custom-status.error,body.night .custom-form-status.error,body.night .custom-card-note.error,body.night .custom-action.danger-text{color:#f0a7a0}

@media(max-width:750px){
  .custom-connect{padding:18px 16px}
  .custom-connect-head{display:block}
  .custom-connect-head .ui-button{width:100%;margin-top:14px}
  .custom-list{grid-template-columns:1fr}
  .custom-dialog form{padding:18px 16px}
  .custom-dialog footer .ui-button{flex:1}
}
